зеркало из https://github.com/microsoft/git.git
Merge branch 'fc/decorate-tag'
* fc/decorate-tag: Prettify log decorations even more Change prettify_ref to prettify_refname
This commit is contained in:
Коммит
44ee247f8d
|
@ -197,7 +197,7 @@ static int update_local_ref(struct ref *ref,
|
|||
struct commit *current = NULL, *updated;
|
||||
enum object_type type;
|
||||
struct branch *current_branch = branch_get(NULL);
|
||||
const char *pretty_ref = prettify_ref(ref);
|
||||
const char *pretty_ref = prettify_refname(ref->name);
|
||||
|
||||
*display = 0;
|
||||
type = sha1_object_info(ref->new_sha1, NULL);
|
||||
|
|
|
@ -178,9 +178,9 @@ static void print_ref_status(char flag, const char *summary, struct ref *to, str
|
|||
{
|
||||
fprintf(stderr, " %c %-*s ", flag, SUMMARY_WIDTH, summary);
|
||||
if (from)
|
||||
fprintf(stderr, "%s -> %s", prettify_ref(from), prettify_ref(to));
|
||||
fprintf(stderr, "%s -> %s", prettify_refname(from->name), prettify_refname(to->name));
|
||||
else
|
||||
fputs(prettify_ref(to), stderr);
|
||||
fputs(prettify_refname(to->name), stderr);
|
||||
if (msg) {
|
||||
fputs(" (", stderr);
|
||||
fputs(msg, stderr);
|
||||
|
|
|
@ -25,6 +25,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
|
|||
struct object *obj = parse_object(sha1);
|
||||
if (!obj)
|
||||
return 0;
|
||||
refname = prettify_refname(refname);
|
||||
add_name_decoration("", refname, obj);
|
||||
while (obj->type == OBJ_TAG) {
|
||||
obj = ((struct tag *)obj)->tagged;
|
||||
|
|
3
refs.c
3
refs.c
|
@ -751,9 +751,8 @@ int check_ref_format(const char *ref)
|
|||
}
|
||||
}
|
||||
|
||||
const char *prettify_ref(const struct ref *ref)
|
||||
const char *prettify_refname(const char *name)
|
||||
{
|
||||
const char *name = ref->name;
|
||||
return name + (
|
||||
!prefixcmp(name, "refs/heads/") ? 11 :
|
||||
!prefixcmp(name, "refs/tags/") ? 10 :
|
||||
|
|
2
refs.h
2
refs.h
|
@ -80,7 +80,7 @@ extern int for_each_reflog(each_ref_fn, void *);
|
|||
#define CHECK_REF_FORMAT_WILDCARD (-3)
|
||||
extern int check_ref_format(const char *target);
|
||||
|
||||
extern const char *prettify_ref(const struct ref *ref);
|
||||
extern const char *prettify_refname(const char *refname);
|
||||
extern char *shorten_unambiguous_ref(const char *ref, int strict);
|
||||
|
||||
/** rename ref, return 0 on success **/
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
$ git log --decorate --all
|
||||
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (refs/heads/master)
|
||||
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (master)
|
||||
Merge: 9a6d494 c7a2ab9
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||
|
||||
Merge branch 'side'
|
||||
|
||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a (refs/heads/side)
|
||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a (side)
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:03:00 2006 +0000
|
||||
|
||||
|
@ -26,7 +26,7 @@ Date: Mon Jun 26 00:01:00 2006 +0000
|
|||
|
||||
This is the second commit.
|
||||
|
||||
commit 444ac553ac7612cc88969031b02b3767fb8a353a (refs/heads/initial)
|
||||
commit 444ac553ac7612cc88969031b02b3767fb8a353a (initial)
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:00:00 2006 +0000
|
||||
|
||||
|
|
|
@ -732,9 +732,9 @@ static void print_ref_status(char flag, const char *summary, struct ref *to, str
|
|||
{
|
||||
fprintf(stderr, " %c %-*s ", flag, SUMMARY_WIDTH, summary);
|
||||
if (from)
|
||||
fprintf(stderr, "%s -> %s", prettify_ref(from), prettify_ref(to));
|
||||
fprintf(stderr, "%s -> %s", prettify_refname(from->name), prettify_refname(to->name));
|
||||
else
|
||||
fputs(prettify_ref(to), stderr);
|
||||
fputs(prettify_refname(to->name), stderr);
|
||||
if (msg) {
|
||||
fputs(" (", stderr);
|
||||
fputs(msg, stderr);
|
||||
|
|
Загрузка…
Ссылка в новой задаче