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

Re: [PATCH 2/2] line-log: avoid unnecessary full tree diffs

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Aug 22, 2019, 16:26 UTC
Message-ID
<20190822162656.GE20404@szeder.dev>
In-Reply-To
<xmqq7e75qjdj.fsf@gitster-ct.c.googlers.com>
On Thu, Aug 22, 2019 at 09:01:44AM -0700, Junio C Hamano wrote:
Show 16 quoted lines
> SZEDER Gábor <szeder.dev@gmail.com> writes:
> 
> > Well, that fruit hung much lower than I though, just look at the size
> > of the WIP patch below.  I just hope that there are no unexpected
> > surprises, but FWIW it produces the exact same output for all files up
> > to 't/t5515' in v2.23.0 as the previous patch.
> >
> > Can't wait to see how it fares with that evil Windows path :)
> >
> >   --- >8 ---
> >
> > Subject: [PATCH 3/2] WIP line-log: stop diff-ing after first TREESAME merge parent
> 
> A quick question.  That we need "stop diffing after first treesame"
> patch in the first place means we have always been attempting to
> follow all the parents of a merge?
To follow, no.

But there are two subsequent loops: the first loop computed the diffs between the merge and each of its parents, while the second processed those diffs, and returned as soon as it found a treesame parent, without following the others.

This patch unified those two loops so it computes the diff with the first parent, and then processes that diff right away, and returns if treesame, thereby avoding diffing the remaining parents.

>  I'd expect that to happen when
> "--full-history" was given to "git log -L..." invocation.

Oh, right, I didn't consider '--full-history'. In that case it should not stop at the first parent.

Hmm, looking into this, it seems that line-level log doesn't work with '--full-history' to begin with:

  # Each commit does what the subject says.
  $ git log --oneline --graph
  *   f9bf557 (HEAD -> master) Merge branch 'branch'
  |\  
  | * 1b573fb (branch) Revert "Modify file"
  | * 3634cf3 Modify file
  |/  
  * 8842c18 Add file
  $ git log --oneline file
  8842c18 Add file
  $ git log --oneline --full-history file
  1b573fb (branch) Revert "Modify file"
  3634cf3 Modify file
  8842c18 Add file
  $ ~/src/git/BUILDS/v2.23.0/bin/git log -L1:file --oneline --no-patch
  8842c18 Add file
  $ ~/src/git/BUILDS/v2.23.0/bin/git log -L1:file --oneline --no-patch --full-history
  8842c18 Add file
Previous: Junio C HamanoNext: Derrick Stolee
Message 10 of 13 in “line-log: avoid unnecessary full tree diffs”
  1. 0/2 line-log: avoid unnecessary full tree diffsSZEDER Gábor, Aug 21, 2019
  2. 1/2 line-log: extract pathspec parsing from line ranges into a helper functionSZEDER Gábor, Aug 21, 2019
  3. 2/2 line-log: avoid unnecessary full tree diffsSZEDER Gábor, Aug 21, 2019
  4. Derrick StoleeAug 21, 2019
  5. SZEDER GáborAug 21, 2019
  6. Derrick StoleeAug 21, 2019
  7. SZEDER GáborAug 22, 2019
  8. Derrick StoleeAug 22, 2019
  9. Junio C HamanoAug 22, 2019
  10. SZEDER GáborAug 22, 2019
  11. Derrick StoleeAug 22, 2019
  12. SZEDER GáborAug 23, 2019
  13. Junio C HamanoAug 21, 2019

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.