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

Re: [PATCH 1/1] diffcore: add a filter to find a specific blob

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 25, 2017, 04:59 UTC
Message-ID
<xmqq8tevkl6x.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqpo88m896.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> If that is the case, shouldn't we make this new mode imply
> --full-history to forbid history simplification?  "git log" is a
> tool to find _an_ explanation of the current state, and the usual
> history simplification makes tons of sense there, but blobfind is
> run most likely in order to find _all_ mention of the set of blobs
> given.
One scenario that I think we may want to be careful about is this:
 ---o---*---*---A*--M*--o---X
     \             /
      o---*---o---B

where commits marked with '*' has the same blob M:Makefile you are looking for at the same path Makefile, and we start traversal at X with "git log --blobfind=M:Makefile X" (or even with a pathspec, i.e. "git log --blobfind=M:Makefile X -- Makefile).

The usual merge simplification rules would say "Ah, M and A are TREESAME so we do not have to look at the side branch that ends at B". If the user is interested in finding all the introduction and the retirement of a specific blob object, we would miss the transition around the '*' on that side branch and ends up finding only the transitions after the fork point where the blob is introduced, and after M where the blob is retired.

Another interesting case we may want to be careful is this:
    ---A*--M*--o---X
          /
      ---B*

for the same reason. The usual merge simplification rules are designed to come up with _an_ explanation for the state in X, and because M is TREESAME with both A and B, it would pick just one (the first parent) while ignoring the other. Again, that would not be appropriate if the reason why the user is running the command is to find all the introduction and the retirement of an object.

It may be worth covering these in the tests (I didn't try to see specifically if the patch has these cases already, as I didn't think of the issue when I responded---sorry about that).

Thanks.
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 5 in “Teaching the diff machinery about blobfind [WAS: git describe <blob>]”
  1. 0/1 Teaching the diff machinery about blobfind [WAS: git describe <blob>]Stefan Beller, Nov 20, 2017
  2. 1/1 diffcore: add a filter to find a specific blobStefan Beller, Nov 20, 2017
  3. Junio C HamanoNov 24, 2017
  4. Junio C HamanoNov 25, 2017
  5. Junio C HamanoDec 7, 2017

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.