summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2009-03-08 21:06:05 -0400
committerJunio C Hamano <gitster@pobox.com>2009-03-09 15:41:16 -0700
commita9c37a72c4fbc8537de294d66b05bdfd7f9a4016 (patch)
tree117ca075b1b84094aaabc9e4145434868ab43228 /refs.c
parent8321c56b6bae25a2d70790f452df894be536b32c (diff)
downloadgit-a9c37a72c4fbc8537de294d66b05bdfd7f9a4016.tar.gz
Use a common function to get the pretty name of refs
The result should be consistent between fetch and push, so we ought to use the same code in both cases, even though it's short. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index b2a37e1185..8f968b51a1 100644
--- a/refs.c
+++ b/refs.c
@@ -736,6 +736,16 @@ int check_ref_format(const char *ref)
}
}
+const char *prettify_ref(const struct ref *ref)
+{
+ const char *name = ref->name;
+ return name + (
+ !prefixcmp(name, "refs/heads/") ? 11 :
+ !prefixcmp(name, "refs/tags/") ? 10 :
+ !prefixcmp(name, "refs/remotes/") ? 13 :
+ 0);
+}
+
const char *ref_rev_parse_rules[] = {
"%.*s",
"refs/%.*s",