[PATCH 75/86] builtin/rev-parse: replace prefixcmd() with has_prefix()
flat view
STALE3780d
From: Christian Couder <hidden>
Date: 2016-06-15 22:59:12
Subsystem:
the rest · Maintainer:
Linus Torvalds
Signed-off-by: Christian Couder <redacted> --- builtin/rev-parse.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index c76b89d..b6c92e0 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c@@ -508,7 +508,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) } continue; } - if (!prefixcmp(arg, "-n")) { + if (has_prefix(arg, "-n")) { if ((filter & DO_FLAGS) && (filter & DO_REVS)) show(arg); continue;
@@ -560,7 +560,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) continue; } if (!strcmp(arg, "--short") || - !prefixcmp(arg, "--short=")) { + has_prefix(arg, "--short=")) { filter &= ~(DO_FLAGS|DO_NOREV); verify = 1; abbrev = DEFAULT_ABBREV;
@@ -588,7 +588,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) symbolic = SHOW_SYMBOLIC_FULL; continue; } - if (!prefixcmp(arg, "--abbrev-ref") && + if (has_prefix(arg, "--abbrev-ref") && (!arg[12] || arg[12] == '=')) { abbrev_ref = 1; abbrev_ref_strict = warn_ambiguous_refs;
@@ -606,7 +606,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) for_each_ref(show_reference, NULL); continue; } - if (!prefixcmp(arg, "--disambiguate=")) { + if (has_prefix(arg, "--disambiguate=")) { for_each_abbrev(arg + 15, show_abbrev, NULL); continue; }
@@ -615,7 +615,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) for_each_ref_in("refs/bisect/good", anti_reference, NULL); continue; } - if (!prefixcmp(arg, "--branches=")) { + if (has_prefix(arg, "--branches=")) { for_each_glob_ref_in(show_reference, arg + 11, "refs/heads/", NULL); continue;
@@ -624,7 +624,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) for_each_branch_ref(show_reference, NULL); continue; } - if (!prefixcmp(arg, "--tags=")) { + if (has_prefix(arg, "--tags=")) { for_each_glob_ref_in(show_reference, arg + 7, "refs/tags/", NULL); continue;
@@ -633,11 +633,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) for_each_tag_ref(show_reference, NULL); continue; } - if (!prefixcmp(arg, "--glob=")) { + if (has_prefix(arg, "--glob=")) { for_each_glob_ref(show_reference, arg + 7, NULL); continue; } - if (!prefixcmp(arg, "--remotes=")) { + if (has_prefix(arg, "--remotes=")) { for_each_glob_ref_in(show_reference, arg + 10, "refs/remotes/", NULL); continue;
@@ -724,19 +724,19 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) : "false"); continue; } - if (!prefixcmp(arg, "--since=")) { + if (has_prefix(arg, "--since=")) { show_datestring("--max-age=", arg+8); continue; } - if (!prefixcmp(arg, "--after=")) { + if (has_prefix(arg, "--after=")) { show_datestring("--max-age=", arg+8); continue; } - if (!prefixcmp(arg, "--before=")) { + if (has_prefix(arg, "--before=")) { show_datestring("--min-age=", arg+9); continue; } - if (!prefixcmp(arg, "--until=")) { + if (has_prefix(arg, "--until=")) { show_datestring("--min-age=", arg+8); continue; }
--
1.8.4.1.566.geca833c