Skip to content

Commit 72885a6

Browse files
chriscoolgitster
authored andcommitted
index-pack: use skip_to_optional_arg()
Let's simplify index-pack option parsing using skip_to_optional_arg(). Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent afaef55 commit 72885a6

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

builtin/index-pack.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,10 +1660,7 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
16601660
from_stdin = 1;
16611661
} else if (!strcmp(arg, "--fix-thin")) {
16621662
fix_thin_pack = 1;
1663-
} else if (!strcmp(arg, "--strict")) {
1664-
strict = 1;
1665-
do_fsck_object = 1;
1666-
} else if (skip_prefix(arg, "--strict=", &arg)) {
1663+
} else if (skip_to_optional_arg(arg, "--strict", &arg)) {
16671664
strict = 1;
16681665
do_fsck_object = 1;
16691666
fsck_set_msg_types(&fsck_options, arg);
@@ -1679,10 +1676,8 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
16791676
verify = 1;
16801677
show_stat = 1;
16811678
stat_only = 1;
1682-
} else if (!strcmp(arg, "--keep")) {
1683-
keep_msg = "";
1684-
} else if (starts_with(arg, "--keep=")) {
1685-
keep_msg = arg + 7;
1679+
} else if (skip_to_optional_arg(arg, "--keep", &keep_msg)) {
1680+
; /* nothing to do */
16861681
} else if (starts_with(arg, "--threads=")) {
16871682
char *end;
16881683
nr_threads = strtoul(arg+10, &end, 0);

0 commit comments

Comments
 (0)