Skip to content

Commit

Permalink
log: decorate "replaced" on to replaced commits
Browse files Browse the repository at this point in the history
Old code also decorates "new" commits with "refs/replace/SHA1". This
is now gone, but I guess no one will miss it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Aug 19, 2011
1 parent 76f5df3 commit 5267d29
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion log-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,22 @@ static void add_name_decoration(enum decoration_type type, const char *name, str

static int add_ref_decoration(const char *refname, const unsigned char *sha1, int flags, void *cb_data)
{
struct object *obj = parse_object(sha1);
struct object *obj;
enum decoration_type type = DECORATION_NONE;

if (!prefixcmp(refname, "refs/replace/")) {
unsigned char original_sha1[20];
if (get_sha1_hex(refname + 13, original_sha1)) {
warning("invalid replace ref %s", refname);
return 0;
}
obj = parse_object(original_sha1);
if (obj)
add_name_decoration(DECORATION_GRAFTED, "replaced", obj);
return 0;
}

obj = parse_object(sha1);
if (!obj)
return 0;

Expand Down

0 comments on commit 5267d29

Please sign in to comment.