git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Junio C HamanoNext: Nguyễn Thái Ngọc Duy
Message 3 of 14 in “log: decorate grafted commits with "grafted"”
  1. log: decorate grafted commits with "grafted"Nguyễn Thái Ngọc Duy, Aug 17, 2011
  2. Junio C HamanoAug 17, 2011
  3. Nguyen Thai Ngoc DuyAug 18, 2011
  4. 0/5 Decorate grafts and replacesNguyễn Thái Ngọc Duy, Aug 18, 2011
  5. 1/5 decoration: do not mis-decorate refs with same prefixNguyễn Thái Ngọc Duy, Aug 18, 2011
  6. Junio C HamanoAug 18, 2011
  7. 2/5 Add for_each_commit_graft() to iterate all graftsNguyễn Thái Ngọc Duy, Aug 18, 2011
  8. 3/5 Move write_shallow_commits to fetch-pack.cNguyễn Thái Ngọc Duy, Aug 18, 2011
  9. Junio C HamanoAug 18, 2011
  10. 4/5 log: decorate grafted commits with "grafted"Nguyễn Thái Ngọc Duy, Aug 18, 2011
  11. Junio C HamanoAug 18, 2011
  12. 5/5 log: decorate "replaced" on to replaced commitsNguyễn Thái Ngọc Duy, Aug 18, 2011
  13. Junio C HamanoAug 18, 2011
  14. log: decorate "replaced" on to replaced commitsNguyễn Thái Ngọc Duy, Aug 19, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.