Re: [PATCH] log: decorate grafted commits with "grafted"
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Aug 18, 2011, 02:02 UTC
- Message-ID
- <CACsJy8DvbN6w_ZBpjPdjpdsyYPa=O2G8gpcu2Oxx-mbvz_+4=A@mail.gmail.com>
- In-Reply-To
- <7v8vqreuwk.fsf@alter.siamese.dyndns.org>
2011/8/18 Junio C Hamano <gitster@pobox.com>:
Show 15 quoted lines
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> 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