summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2013-11-05 22:02:36 +0100
committerJunio C Hamano <gitster@pobox.com>2013-11-06 13:10:33 -0800
commit76e08227e5bc8b6e3d208da965d2421911d25ae3 (patch)
treefffe84cc3010906389eab2e95f80988f1fff4056 /builtin
parentd2e146d8d7052b8482859e64daf2b86c019531f8 (diff)
downloadgit-76e08227e5bc8b6e3d208da965d2421911d25ae3.tar.gz
Rename suffixcmp() to has_suffix() and invert its resultcc/remote-remove-redundant-postfixcmp
Now has_suffix() returns 1 when the suffix is present and 0 otherwise. The old name followed the pattern anything-cmp(), which suggests a general comparison function suitable for e.g. sorting objects. But this was not the case for suffixcmp(). Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/clone.c2
-rw-r--r--builtin/fetch.c2
-rw-r--r--builtin/merge-recursive.c2
-rw-r--r--builtin/remote.c6
-rw-r--r--builtin/repack.c2
5 files changed, 7 insertions, 7 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 874e0fd0b6..84fb1bdeee 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -510,7 +510,7 @@ static void write_followtags(const struct ref *refs, const char *msg)
for (ref = refs; ref; ref = ref->next) {
if (prefixcmp(ref->name, "refs/tags/"))
continue;
- if (!suffixcmp(ref->name, "^{}"))
+ if (has_suffix(ref->name, "^{}"))
continue;
if (!has_sha1_file(ref->old_sha1))
continue;
diff --git a/builtin/fetch.c b/builtin/fetch.c
index bd7a10164f..8eb6cd0582 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -653,7 +653,7 @@ static void find_non_local_tags(struct transport *transport,
* to fetch then we can mark the ref entry in the list
* as one to ignore by setting util to NULL.
*/
- if (!suffixcmp(ref->name, "^{}")) {
+ if (has_suffix(ref->name, "^{}")) {
if (item && !has_sha1_file(ref->old_sha1) &&
!will_fetch(head, ref->old_sha1) &&
!has_sha1_file(item->util) &&
diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c
index 3a64f5d0bd..e7f1a39df3 100644
--- a/builtin/merge-recursive.c
+++ b/builtin/merge-recursive.c
@@ -29,7 +29,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
struct commit *result;
init_merge_options(&o);
- if (argv[0] && !suffixcmp(argv[0], "-subtree"))
+ if (argv[0] && has_suffix(argv[0], "-subtree"))
o.subtree_shift = "";
if (argc < 4)
diff --git a/builtin/remote.c b/builtin/remote.c
index 9b3a98e415..b9a1024cc4 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -269,13 +269,13 @@ static int config_read_branches(const char *key, const char *value, void *cb)
enum { REMOTE, MERGE, REBASE } type;
key += 7;
- if (!suffixcmp(key, ".remote")) {
+ if (has_suffix(key, ".remote")) {
name = xstrndup(key, strlen(key) - 7);
type = REMOTE;
- } else if (!suffixcmp(key, ".merge")) {
+ } else if (has_suffix(key, ".merge")) {
name = xstrndup(key, strlen(key) - 6);
type = MERGE;
- } else if (!suffixcmp(key, ".rebase")) {
+ } else if (has_suffix(key, ".rebase")) {
name = xstrndup(key, strlen(key) - 7);
type = REBASE;
} else
diff --git a/builtin/repack.c b/builtin/repack.c
index a0ff5c704f..9ef518d0d6 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -78,7 +78,7 @@ static void get_non_kept_pack_filenames(struct string_list *fname_list)
return;
while ((e = readdir(dir)) != NULL) {
- if (suffixcmp(e->d_name, ".pack"))
+ if (!has_suffix(e->d_name, ".pack"))
continue;
len = strlen(e->d_name) - strlen(".pack");