From: Junio C Hamano Date: Wed, 16 Jul 2014 18:33:06 +0000 (-0700) Subject: Merge branch 'jk/skip-prefix' X-Git-Tag: v2.1.0-rc0~32 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f357797678aa5ae35c63623b8b76eb682d5b9b79?ds=inline;hp=-c Merge branch 'jk/skip-prefix' One more to an already graduated topic. * jk/skip-prefix: tag: use skip_prefix instead of magic numbers --- f357797678aa5ae35c63623b8b76eb682d5b9b79 diff --combined builtin/tag.c index ef76556338,1101c19596..9d7643f127 --- a/builtin/tag.c +++ b/builtin/tag.c @@@ -83,7 -83,7 +83,7 @@@ static int in_commit_list(const struct enum contains_result { CONTAINS_UNKNOWN = -1, CONTAINS_NO = 0, - CONTAINS_YES = 1, + CONTAINS_YES = 1 }; /* @@@ -524,18 -524,14 +524,14 @@@ static int parse_opt_sort(const struct int *sort = opt->value; int flags = 0; - if (*arg == '-') { + if (skip_prefix(arg, "-", &arg)) flags |= REVERSE_SORT; - arg++; - } - if (starts_with(arg, "version:")) { - *sort = VERCMP_SORT; - arg += 8; - } else if (starts_with(arg, "v:")) { + + if (skip_prefix(arg, "version:", &arg) || skip_prefix(arg, "v:", &arg)) *sort = VERCMP_SORT; - arg += 2; - } else + else *sort = STRCMP_SORT; + if (strcmp(arg, "refname")) die(_("unsupported sort specification %s"), arg); *sort |= flags;