Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
revision.c: use skip_prefix() in handle_revision_pseudo_opt()
author
SZEDER Gábor
<szeder.dev@gmail.com>
Fri, 9 Jun 2017 18:17:33 +0000
(20:17 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 12 Jun 2017 20:39:52 +0000
(13:39 -0700)
Instead of starts_with() and a bunch of magic numbers.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
479b3d9
)
diff --git
a/revision.c
b/revision.c
index bb2e09454944006c15be31a8355711c8718c8f57..2f6f75f960926eb85fc80a01ecb7f08fd34c271a 100644
(file)
--- a/
revision.c
+++ b/
revision.c
@@
-2099,20
+2099,20
@@
static int handle_revision_pseudo_opt(const char *submodule,
} else if ((argcount = parse_long_opt("exclude", argv, &optarg))) {
add_ref_exclusion(&revs->ref_excludes, optarg);
return argcount;
} else if ((argcount = parse_long_opt("exclude", argv, &optarg))) {
add_ref_exclusion(&revs->ref_excludes, optarg);
return argcount;
- } else if (s
tarts_with(arg, "--branches="
)) {
+ } else if (s
kip_prefix(arg, "--branches=", &optarg
)) {
struct all_refs_cb cb;
init_all_refs_cb(&cb, revs, *flags);
struct all_refs_cb cb;
init_all_refs_cb(&cb, revs, *flags);
- for_each_glob_ref_in(handle_one_ref,
arg + 11
, "refs/heads/", &cb);
+ for_each_glob_ref_in(handle_one_ref,
optarg
, "refs/heads/", &cb);
clear_ref_exclusion(&revs->ref_excludes);
clear_ref_exclusion(&revs->ref_excludes);
- } else if (s
tarts_with(arg, "--tags="
)) {
+ } else if (s
kip_prefix(arg, "--tags=", &optarg
)) {
struct all_refs_cb cb;
init_all_refs_cb(&cb, revs, *flags);
struct all_refs_cb cb;
init_all_refs_cb(&cb, revs, *flags);
- for_each_glob_ref_in(handle_one_ref,
arg + 7
, "refs/tags/", &cb);
+ for_each_glob_ref_in(handle_one_ref,
optarg
, "refs/tags/", &cb);
clear_ref_exclusion(&revs->ref_excludes);
clear_ref_exclusion(&revs->ref_excludes);
- } else if (s
tarts_with(arg, "--remotes="
)) {
+ } else if (s
kip_prefix(arg, "--remotes=", &optarg
)) {
struct all_refs_cb cb;
init_all_refs_cb(&cb, revs, *flags);
struct all_refs_cb cb;
init_all_refs_cb(&cb, revs, *flags);
- for_each_glob_ref_in(handle_one_ref,
arg + 10
, "refs/remotes/", &cb);
+ for_each_glob_ref_in(handle_one_ref,
optarg
, "refs/remotes/", &cb);
clear_ref_exclusion(&revs->ref_excludes);
} else if (!strcmp(arg, "--reflog")) {
add_reflogs_to_pending(revs, *flags);
clear_ref_exclusion(&revs->ref_excludes);
} else if (!strcmp(arg, "--reflog")) {
add_reflogs_to_pending(revs, *flags);
@@
-2122,14
+2122,14
@@
static int handle_revision_pseudo_opt(const char *submodule,
*flags ^= UNINTERESTING | BOTTOM;
} else if (!strcmp(arg, "--no-walk")) {
revs->no_walk = REVISION_WALK_NO_WALK_SORTED;
*flags ^= UNINTERESTING | BOTTOM;
} else if (!strcmp(arg, "--no-walk")) {
revs->no_walk = REVISION_WALK_NO_WALK_SORTED;
- } else if (s
tarts_with(arg, "--no-walk="
)) {
+ } else if (s
kip_prefix(arg, "--no-walk=", &optarg
)) {
/*
* Detached form ("--no-walk X" as opposed to "--no-walk=X")
* not allowed, since the argument is optional.
*/
/*
* Detached form ("--no-walk X" as opposed to "--no-walk=X")
* not allowed, since the argument is optional.
*/
- if (!strcmp(
arg + 10
, "sorted"))
+ if (!strcmp(
optarg
, "sorted"))
revs->no_walk = REVISION_WALK_NO_WALK_SORTED;
revs->no_walk = REVISION_WALK_NO_WALK_SORTED;
- else if (!strcmp(
arg + 10
, "unsorted"))
+ else if (!strcmp(
optarg
, "unsorted"))
revs->no_walk = REVISION_WALK_NO_WALK_UNSORTED;
else
return error("invalid argument to --no-walk");
revs->no_walk = REVISION_WALK_NO_WALK_UNSORTED;
else
return error("invalid argument to --no-walk");