summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8321c56)
raw | patch | inline | side by side (parent: 8321c56)
author | Daniel Barkalow <barkalow@iabervon.org> | |
Mon, 9 Mar 2009 01:06:05 +0000 (21:06 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 9 Mar 2009 22:41:16 +0000 (15:41 -0700) |
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>
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>
builtin-fetch.c | patch | blob | history | |
builtin-send-pack.c | patch | blob | history | |
refs.c | patch | blob | history | |
refs.h | patch | blob | history |
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 1e4a3d9c516c88d701819b7f4b73c722412d540f..f3bdeda05994179dcd564e4a2ae758ca0d2c23a0 100644 (file)
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
struct commit *current = NULL, *updated;
enum object_type type;
struct branch *current_branch = branch_get(NULL);
- const char *pretty_ref = ref->name + (
- !prefixcmp(ref->name, "refs/heads/") ? 11 :
- !prefixcmp(ref->name, "refs/tags/") ? 10 :
- !prefixcmp(ref->name, "refs/remotes/") ? 13 :
- 0);
+ const char *pretty_ref = prettify_ref(ref);
*display = 0;
type = sha1_object_info(ref->new_sha1, NULL);
diff --git a/builtin-send-pack.c b/builtin-send-pack.c
index 9072905f10cbbb0f8297bc1b1c7dfb12613c80a7..43b89ece36ed0a50f2fb298c0159f08ffa5f8700 100644 (file)
--- a/builtin-send-pack.c
+++ b/builtin-send-pack.c
}
}
-static 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);
-}
-
#define SUMMARY_WIDTH (2 * DEFAULT_ABBREV + 3)
static void print_ref_status(char flag, const char *summary, struct ref *to, struct ref *from, const char *msg)
index b2a37e1185704733faa4d8395b996dc80d3f19ef..8f968b51a1fd616c2cef33c338c97b692ec888cb 100644 (file)
--- a/refs.c
+++ b/refs.c
}
}
+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",
index 29bdcecd4edb5e7281a4da36a06aa05e025f38a7..68c2d16d5388f5591a610e1d6fcf2f731159ecb2 100644 (file)
--- a/refs.h
+++ b/refs.h
#define CHECK_REF_FORMAT_WILDCARD (-3)
extern int check_ref_format(const char *target);
+extern const char *prettify_ref(const struct ref *ref);
+
/** rename ref, return 0 on success **/
extern int rename_ref(const char *oldref, const char *newref, const char *logmsg);