log: decorate "replaced" on to replaced commits

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>

Nguyễn Thái Ngọc Duy committed Aug 19, 2011 at 19:43 UTC 5267d292ecbdc91018db05275ec6057d2c4cfa18
1 file changed +15 -1
log-tree.c
+15 -1
@@ -92,8 +92,22 @@ static void add_name_decoration(enum decoration_type type, const char *name, str
92
93 static int add_ref_decoration(const char *refname, const unsigned char *sha1, int flags, void *cb_data)
94 {
95 - struct object *obj = parse_object(sha1);
95 + struct object *obj;
96 enum decoration_type type = DECORATION_NONE;
97 +
98 + if (!prefixcmp(refname, "refs/replace/")) {
99 + unsigned char original_sha1[20];
100 + if (get_sha1_hex(refname + 13, original_sha1)) {
101 + warning("invalid replace ref %s", refname);
102 + return 0;
103 + }
104 + obj = parse_object(original_sha1);
105 + if (obj)
106 + add_name_decoration(DECORATION_GRAFTED, "replaced", obj);
107 + return 0;
108 + }
109 +
110 + obj = parse_object(sha1);
111 if (!obj)
112 return 0;
113