Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
log: decorate "replaced" on to replaced commits
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Fri, 19 Aug 2011 12:43:50 +0000
(19:43 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 19 Aug 2011 18:12:10 +0000
(11:12 -0700)
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>
log-tree.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
76f5df3
)
diff --git
a/log-tree.c
b/log-tree.c
index 56052441e253e6fb69609edd21909f008eb0d360..74fc20da4dcc4492379904bbc55edb3ac6244d94 100644
(file)
--- a/
log-tree.c
+++ b/
log-tree.c
@@
-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)
{
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;
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;
if (!obj)
return 0;