Merge branch 'jk/skip-prefix'
One more to an already graduated topic. * jk/skip-prefix: tag: use skip_prefix instead of magic numbers
This commit is contained in:
commit
f357797678
@ -524,18 +524,14 @@ static int parse_opt_sort(const struct option *opt, const char *arg, int unset)
|
|||||||
int *sort = opt->value;
|
int *sort = opt->value;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
if (*arg == '-') {
|
if (skip_prefix(arg, "-", &arg))
|
||||||
flags |= REVERSE_SORT;
|
flags |= REVERSE_SORT;
|
||||||
arg++;
|
|
||||||
}
|
if (skip_prefix(arg, "version:", &arg) || skip_prefix(arg, "v:", &arg))
|
||||||
if (starts_with(arg, "version:")) {
|
|
||||||
*sort = VERCMP_SORT;
|
*sort = VERCMP_SORT;
|
||||||
arg += 8;
|
else
|
||||||
} else if (starts_with(arg, "v:")) {
|
|
||||||
*sort = VERCMP_SORT;
|
|
||||||
arg += 2;
|
|
||||||
} else
|
|
||||||
*sort = STRCMP_SORT;
|
*sort = STRCMP_SORT;
|
||||||
|
|
||||||
if (strcmp(arg, "refname"))
|
if (strcmp(arg, "refname"))
|
||||||
die(_("unsupported sort specification %s"), arg);
|
die(_("unsupported sort specification %s"), arg);
|
||||||
*sort |= flags;
|
*sort |= flags;
|
||||||
|
Loading…
Reference in New Issue
Block a user