diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-12-17 11:47:35 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-12-17 12:02:44 -0800 |
commit | ad7044857660af7ffaaf8fbbccc77b817d1b938f (patch) | |
tree | b77a7390dbbc1901e13d74c1738f327e5fa8154d /builtin/name-rev.c | |
parent | 14a9c5f261bcc436b80700076257f02af0beec68 (diff) | |
parent | 59556548230e617b837343c2c07e357e688e2ca4 (diff) | |
download | git-ad7044857660af7ffaaf8fbbccc77b817d1b938f.tar.gz |
Merge branch 'cc/starts-n-ends-with'
Remove a few duplicate implementations of prefix/suffix comparison
functions, and rename them to starts_with and ends_with.
* cc/starts-n-ends-with:
replace {pre,suf}fixcmp() with {starts,ends}_with()
strbuf: introduce starts_with() and ends_with()
builtin/remote: remove postfixcmp() and use suffixcmp() instead
environment: normalize use of prefixcmp() by removing " != 0"
Diffstat (limited to 'builtin/name-rev.c')
-rw-r--r-- | builtin/name-rev.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 23daaa7d99..0b21d7e5b2 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -100,9 +100,9 @@ static const char *name_ref_abbrev(const char *refname, int shorten_unambiguous) { if (shorten_unambiguous) refname = shorten_unambiguous_ref(refname, 0); - else if (!prefixcmp(refname, "refs/heads/")) + else if (starts_with(refname, "refs/heads/")) refname = refname + 11; - else if (!prefixcmp(refname, "refs/")) + else if (starts_with(refname, "refs/")) refname = refname + 5; return refname; } @@ -148,7 +148,7 @@ static int name_ref(const char *path, const unsigned char *sha1, int flags, void int can_abbreviate_output = data->tags_only && data->name_only; int deref = 0; - if (data->tags_only && prefixcmp(path, "refs/tags/")) + if (data->tags_only && !starts_with(path, "refs/tags/")) return 0; if (data->ref_filter) { |