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

Re: [PATCH v2] log: add --nonlinear-barrier to help see non-linear history

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 18, 2014, 11:46 UTC
Message-ID
<CACsJy8BsEsyrcis=+2HyocYWi9WM2oHKtSFPXzSt5ji6zVgeXA@mail.gmail.com>
In-Reply-To
<xmqqob14d0qv.fsf@gitster.dls.corp.google.com>
On Tue, Mar 18, 2014 at 3:32 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> ---
>>  v2 renames the option name to --nonlinear-barrier and fixes using it
>>  with --dense. Best used with --no-merges to see patch series.
>
> I think that the earlier name "show linear-break" is more easily
> understood than the new name, but maybe that is just me.  It's not
> like you are blocking something from going forward with a barrier,
> and internally it is called a "break-bar".
I'll change it back.
Show 5 quoted lines
>>       opt->loginfo = NULL;
>>       maybe_flush_or_die(stdout, "stdout");
>>       return shown;
>
> Does this new feature interact with -z format output in any way?
Hmm.. never thought of it. Right now it's part of the previous commit.
> Should it, and if so how?
No idea.
Show 33 quoted lines
>> +define_commit_slab(saved_linear, int);
>> +
>> +static void track_linear(struct rev_info *revs, struct commit *commit)
>> +{
>> +     struct commit_list *p = revs->previous_parents;
>> +
>> +     if (p) {
>> +             int got_parent = 0;
>> +             for (; p && !got_parent; p = p->next)
>> +                     got_parent = !hashcmp(p->item->object.sha1,
>> +                                           commit->object.sha1);
>> +             revs->linear = got_parent;
>> +             free_commit_list(revs->previous_parents);
>> +     } else
>> +             revs->linear = 1;
>> +     if (revs->reverse) {
>> +             if (!revs->saved_linear_slab) {
>> +                     revs->saved_linear_slab = xmalloc(sizeof(struct saved_linear));
>> +                     init_saved_linear(revs->saved_linear_slab);
>> +             }
>> +
>> +             *saved_linear_at(revs->saved_linear_slab, commit) = revs->linear;
>> +     }
>> +     revs->previous_parents = copy_commit_list(commit->parents);
>
> We are showing commit, and the parents (after history
> simplification) of the commit we showed before this commit is kept
> in previous-parents.  If we are one of them, we are showing
> linearly, which makes sense.  While we are accumulating the output
> in the forward direction in preparation for later emitting them in
> reverse, we need to save away the linear-ness bit somewhere, and a
> slab is a logical place to save that, which also makes sense.  But
> why do you need a full int?  Doesn't an unsigned char wide enough?
Yes it is. Will change.
> I also wondered if the saved-parents slab we already have can be
> easily reused for this, but it probably would not help.

That could end up a maintenance nightmare. revision.c is complex enough as it is.

> I do not quite understand the "if we do not have previous parents"
> bit, though.  Is it meant to trigger only at the very beginning?
Only at the beginning.
-- 
Duy
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 19 in “Confusing git log --- First time bug submission please advise on best practices”
  1. Francis StephensFeb 6, 2014
  2. Vincent van RavesteijnFeb 6, 2014
  3. David KastrupFeb 6, 2014
  4. Francis StephensFeb 7, 2014
  5. Duy NguyenFeb 7, 2014
  6. demerphqFeb 7, 2014
  7. log: add --show-linear-break to help see non-linear historyNguyễn Thái Ngọc Duy, Feb 8, 2014
  8. log: add --nonlinear-barrier to help see non-linear historyNguyễn Thái Ngọc Duy, Mar 17, 2014
  9. Eric SunshineMar 17, 2014
  10. Junio C HamanoMar 17, 2014
  11. Duy NguyenMar 18, 2014
  12. Junio C HamanoMar 18, 2014
  13. 1/2 object.h: centralize object flag allocationNguyễn Thái Ngọc Duy, Mar 20, 2014
  14. 2/2 log: add --show-linear-break to help see non-linear historyNguyễn Thái Ngọc Duy, Mar 20, 2014
  15. Junio C HamanoMar 20, 2014
  16. Duy NguyenMar 21, 2014
  17. 1/2 object.h: centralize object flag allocationNguyễn Thái Ngọc Duy, Mar 25, 2014
  18. 2/2 log: add --show-linear-break to help see non-linear historyNguyễn Thái Ngọc Duy, Mar 25, 2014
  19. Junio C HamanoMar 25, 2014

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.