summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-16 11:33:06 -0700
committerJunio C Hamano <gitster@pobox.com>2014-07-16 11:33:06 -0700
commitf357797678aa5ae35c63623b8b76eb682d5b9b79 (patch)
tree3db12220f50ea867cc876138f93bca4bde1973a7 /builtin
parent7591e2c53c6f02626e376a98b5f95745fbfe108f (diff)
parentce856044681331d19b867426726db7edd12f1713 (diff)
downloadgit-f357797678aa5ae35c63623b8b76eb682d5b9b79.tar.gz
Merge branch 'jk/skip-prefix'
One more to an already graduated topic. * jk/skip-prefix: tag: use skip_prefix instead of magic numbers
Diffstat (limited to 'builtin')
-rw-r--r--builtin/tag.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/builtin/tag.c b/builtin/tag.c
index ef76556338..9d7643f127 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -524,18 +524,14 @@ static int parse_opt_sort(const struct option *opt, const char *arg, int unset)
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;