From: Nguyen Thai Ngoc Duy Date: Thu, 18 Aug 2011 02:02:50 GMT Subject: Re: [PATCH] log: decorate grafted commits with "grafted" Message-ID: In-Reply-To: <7v8vqreuwk.fsf@alter.siamese.dyndns.org> 2011/8/18 Junio C Hamano : > Nguyễn Thái Ngọc Duy   writes: > >> @@ -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); > > I am not very enthused about this change. > > We have already looked up the commit when we parsed it, and then we again > have to call lookup_commit_graft() which would yield false for most of the > commits? which is why there's "!commit->parents" check. I made this patch with shallow clone in mind. You probably have seen that if grafts are used to extend history instead of cutting it, it won't show. > Does this work with replacements and shallows, by the way? Shallows, yes (that was my aim). Replacements, no. A better way would be go over commit_graft[] and replace_object[] arrays, decorate all grafted/replaced commits, instead of checking in log_tree_commit(). -- Duy