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 <mhagger@alum.mit.edu> Acked-by: Stefan Beller <stefanbeller@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
a155a5f075
commit
3e7b066e22
@ -123,7 +123,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
|||||||
struct string_list rollback = STRING_LIST_INIT_NODUP;
|
struct string_list rollback = STRING_LIST_INIT_NODUP;
|
||||||
struct string_list existing_packs = STRING_LIST_INIT_DUP;
|
struct string_list existing_packs = STRING_LIST_INIT_DUP;
|
||||||
struct strbuf line = STRBUF_INIT;
|
struct strbuf line = STRBUF_INIT;
|
||||||
int nr_packs, ext, ret, failed;
|
int ext, ret, failed;
|
||||||
FILE *out;
|
FILE *out;
|
||||||
|
|
||||||
/* variables to be filled by option parsing */
|
/* variables to be filled by option parsing */
|
||||||
@ -233,13 +233,11 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nr_packs = 0;
|
|
||||||
out = xfdopen(cmd.out, "r");
|
out = xfdopen(cmd.out, "r");
|
||||||
while (strbuf_getline(&line, out, '\n') != EOF) {
|
while (strbuf_getline(&line, out, '\n') != EOF) {
|
||||||
if (line.len != 40)
|
if (line.len != 40)
|
||||||
die("repack: Expecting 40 character sha1 lines only from pack-objects.");
|
die("repack: Expecting 40 character sha1 lines only from pack-objects.");
|
||||||
string_list_append(&names, line.buf);
|
string_list_append(&names, line.buf);
|
||||||
nr_packs++;
|
|
||||||
}
|
}
|
||||||
fclose(out);
|
fclose(out);
|
||||||
ret = finish_command(&cmd);
|
ret = finish_command(&cmd);
|
||||||
@ -247,7 +245,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
|||||||
return ret;
|
return ret;
|
||||||
argv_array_clear(&cmd_args);
|
argv_array_clear(&cmd_args);
|
||||||
|
|
||||||
if (!nr_packs && !quiet)
|
if (!names.nr && !quiet)
|
||||||
printf("Nothing new to pack.\n");
|
printf("Nothing new to pack.\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user