index-pack: use skip_to_optional_arg()

Let's simplify index-pack option parsing using skip_to_optional_arg(). Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Dec 9, 2017 at 21:40 UTC 72885a6d5181ca090039917b6ce76b952ebb59b1
1 file changed +3 -8
builtin/index-pack.c
+3 -8
@@ -1660,10 +1660,7 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
1660 from_stdin = 1;
1661 } else if (!strcmp(arg, "--fix-thin")) {
1662 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)) {
1664 strict = 1;
1665 do_fsck_object = 1;
1666 fsck_set_msg_types(&fsck_options, arg);
@@ -1679,10 +1676,8 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
1676 verify = 1;
1677 show_stat = 1;
1678 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 */
1681 } else if (starts_with(arg, "--threads=")) {
1682 char *end;
1683 nr_threads = strtoul(arg+10, &end, 0);