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>
This commit is contained in:
committed by
Junio C Hamano
parent
8321c56b6b
commit
a9c37a72c4
10
refs.c
10
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",
|
||||
|
||||
Reference in New Issue
Block a user