Skip to content

Commit 3e7b066

Browse files
mhaggergitster
authored andcommitted
cmd_repack(): remove redundant local variable "nr_packs"
Its value is the same as the number of entries in the "names" string_list, so just use "names.nr" in its place. Signed-off-by: Michael Haggerty <[email protected]> Acked-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a155a5f commit 3e7b066

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

builtin/repack.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
123123
struct string_list rollback = STRING_LIST_INIT_NODUP;
124124
struct string_list existing_packs = STRING_LIST_INIT_DUP;
125125
struct strbuf line = STRBUF_INIT;
126-
int nr_packs, ext, ret, failed;
126+
int ext, ret, failed;
127127
FILE *out;
128128

129129
/* variables to be filled by option parsing */
@@ -233,21 +233,19 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
233233
if (ret)
234234
return ret;
235235

236-
nr_packs = 0;
237236
out = xfdopen(cmd.out, "r");
238237
while (strbuf_getline(&line, out, '\n') != EOF) {
239238
if (line.len != 40)
240239
die("repack: Expecting 40 character sha1 lines only from pack-objects.");
241240
string_list_append(&names, line.buf);
242-
nr_packs++;
243241
}
244242
fclose(out);
245243
ret = finish_command(&cmd);
246244
if (ret)
247245
return ret;
248246
argv_array_clear(&cmd_args);
249247

250-
if (!nr_packs && !quiet)
248+
if (!names.nr && !quiet)
251249
printf("Nothing new to pack.\n");
252250

253251
/*

0 commit comments

Comments
 (0)