Subject: [PATCH] log: decorate grafted commits with "grafted"

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Wed, 17 Aug 2011 22:02:06 +0700

This would help decide whether to deepen some more on shallow
repositories, or the branch really has really ends there.

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 I briefly considered wrapping _() around "grafted" text, but
 decided that making it a keyword might help searching

 log-tree.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/log-tree.c b/log-tree.c
index e945701..c469341 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -18,6 +18,7 @@ enum decoration_type {
 	DECORATION_REF_TAG,
 	DECORATION_REF_STASH,
 	DECORATION_REF_HEAD,
+	DECORATION_GRAFTED
 };
 
 static char decoration_colors[][COLOR_MAXLEN] = {
@@ -27,6 +28,7 @@ static char decoration_colors[][COLOR_MAXLEN] = {
 	GIT_COLOR_BOLD_YELLOW,	/* REF_TAG */
 	GIT_COLOR_BOLD_MAGENTA,	/* REF_STASH */
 	GIT_COLOR_BOLD_CYAN,	/* REF_HEAD */
+	GIT_COLOR_BOLD_BLUE,	/* GRAFTED */
 };
 
 static const char *decorate_get_color(int decorate_use_color, enum decoration_type ix)
@@ -638,6 +640,9 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
 	log.parent = NULL;
 	opt->loginfo = &log;
 
+	if (!commit->parents && lookup_commit_graft(commit->object.sha1))
+		add_name_decoration(DECORATION_GRAFTED, "grafted",
+				    &commit->object);
 	shown = log_tree_diff(opt, commit, &log);
 	if (!shown && opt->loginfo && opt->always_show_header) {
 		log.parent = NULL;
-- 
1.7.4.74.g639db