builtin/repack.c: rename variables that deal with non-kept packs
The new variable `existing_kept_packs` (and corresponding parameter `fname_kept_list`) added by the previous patch make it seem like `existing_packs` and `fname_list` are each subsets of the other two respectively. In reality, each pair is disjoint: one stores the packs without .keep files, and the other stores the packs with .keep files. Rename each to more clearly reflect this. Suggested-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Taylor Blau committed
Sep 28, 2021 at 21:55 UTC
a169166d2bc855f7cc0bbf79039b48da91782d95
1 file changed
+11
-11
builtin/repack.c
+11
-11
@@ -94,12 +94,12 @@ static void remove_pack_on_signal(int signo)
94
}
95
96
/*
97
- * Adds all packs hex strings to either fname_list or fname_kept_list
98
- * based on whether each pack has a corresponding .keep file or not.
99
- * Packs without a .keep file are not to be kept if we are going to
100
- * pack everything into one file.
97
+ * Adds all packs hex strings to either fname_nonkept_list or
98
+ * fname_kept_list based on whether each pack has a corresponding
99
+ * .keep file or not. Packs without a .keep file are not to be kept
100
+ * if we are going to pack everything into one file.
101
*/
102
-static void collect_pack_filenames(struct string_list *fname_list,
102
+static void collect_pack_filenames(struct string_list *fname_nonkept_list,
103
struct string_list *fname_kept_list,
104
const struct string_list *extra_keep)
105
{
@@ -127,7 +127,7 @@ static void collect_pack_filenames(struct string_list *fname_list,
127
(file_exists(mkpath("%s/%s.keep", packdir, fname))))
128
string_list_append_nodup(fname_kept_list, fname);
129
else
130
- string_list_append_nodup(fname_list, fname);
130
+ string_list_append_nodup(fname_nonkept_list, fname);
131
}
132
closedir(dir);
133
}
@@ -440,7 +440,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
440
struct string_list_item *item;
441
struct string_list names = STRING_LIST_INIT_DUP;
442
struct string_list rollback = STRING_LIST_INIT_NODUP;
443
- struct string_list existing_packs = STRING_LIST_INIT_DUP;
443
+ struct string_list existing_nonkept_packs = STRING_LIST_INIT_DUP;
444
struct string_list existing_kept_packs = STRING_LIST_INIT_DUP;
445
struct pack_geometry *geometry = NULL;
446
struct strbuf line = STRBUF_INIT;
@@ -574,13 +574,13 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
574
if (use_delta_islands)
575
strvec_push(&cmd.args, "--delta-islands");
576
577
- collect_pack_filenames(&existing_packs, &existing_kept_packs,
577
+ collect_pack_filenames(&existing_nonkept_packs, &existing_kept_packs,
578
&keep_pack_list);
579
580
if (pack_everything & ALL_INTO_ONE) {
581
repack_promisor_objects(&po_args, &names);
582
583
- if (existing_packs.nr && delete_redundant) {
583
+ if (existing_nonkept_packs.nr && delete_redundant) {
584
for_each_string_list_item(item, &names) {
585
strvec_pushf(&cmd.args, "--keep-pack=%s-%s.pack",
586
packtmp_name, item->string);
@@ -690,7 +690,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
690
if (pack_everything & ALL_INTO_ONE) {
691
const int hexsz = the_hash_algo->hexsz;
692
string_list_sort(&names);
693
- for_each_string_list_item(item, &existing_packs) {
693
+ for_each_string_list_item(item, &existing_nonkept_packs) {
694
char *sha1;
695
size_t len = strlen(item->string);
696
if (len < hexsz)
@@ -743,7 +743,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
743
744
string_list_clear(&names, 0);
745
string_list_clear(&rollback, 0);
746
- string_list_clear(&existing_packs, 0);
746
+ string_list_clear(&existing_nonkept_packs, 0);
747
string_list_clear(&existing_kept_packs, 0);
748
clear_pack_geometry(geometry);
749
strbuf_release(&line);