Skip to content

Commit a169166

Browse files
ttaylorrgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 90f838b commit a169166

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

builtin/repack.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ static void remove_pack_on_signal(int signo)
9494
}
9595

9696
/*
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.
101101
*/
102-
static void collect_pack_filenames(struct string_list *fname_list,
102+
static void collect_pack_filenames(struct string_list *fname_nonkept_list,
103103
struct string_list *fname_kept_list,
104104
const struct string_list *extra_keep)
105105
{
@@ -127,7 +127,7 @@ static void collect_pack_filenames(struct string_list *fname_list,
127127
(file_exists(mkpath("%s/%s.keep", packdir, fname))))
128128
string_list_append_nodup(fname_kept_list, fname);
129129
else
130-
string_list_append_nodup(fname_list, fname);
130+
string_list_append_nodup(fname_nonkept_list, fname);
131131
}
132132
closedir(dir);
133133
}
@@ -440,7 +440,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
440440
struct string_list_item *item;
441441
struct string_list names = STRING_LIST_INIT_DUP;
442442
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;
444444
struct string_list existing_kept_packs = STRING_LIST_INIT_DUP;
445445
struct pack_geometry *geometry = NULL;
446446
struct strbuf line = STRBUF_INIT;
@@ -574,13 +574,13 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
574574
if (use_delta_islands)
575575
strvec_push(&cmd.args, "--delta-islands");
576576

577-
collect_pack_filenames(&existing_packs, &existing_kept_packs,
577+
collect_pack_filenames(&existing_nonkept_packs, &existing_kept_packs,
578578
&keep_pack_list);
579579

580580
if (pack_everything & ALL_INTO_ONE) {
581581
repack_promisor_objects(&po_args, &names);
582582

583-
if (existing_packs.nr && delete_redundant) {
583+
if (existing_nonkept_packs.nr && delete_redundant) {
584584
for_each_string_list_item(item, &names) {
585585
strvec_pushf(&cmd.args, "--keep-pack=%s-%s.pack",
586586
packtmp_name, item->string);
@@ -690,7 +690,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
690690
if (pack_everything & ALL_INTO_ONE) {
691691
const int hexsz = the_hash_algo->hexsz;
692692
string_list_sort(&names);
693-
for_each_string_list_item(item, &existing_packs) {
693+
for_each_string_list_item(item, &existing_nonkept_packs) {
694694
char *sha1;
695695
size_t len = strlen(item->string);
696696
if (len < hexsz)
@@ -743,7 +743,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
743743

744744
string_list_clear(&names, 0);
745745
string_list_clear(&rollback, 0);
746-
string_list_clear(&existing_packs, 0);
746+
string_list_clear(&existing_nonkept_packs, 0);
747747
string_list_clear(&existing_kept_packs, 0);
748748
clear_pack_geometry(geometry);
749749
strbuf_release(&line);

0 commit comments

Comments
 (0)