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
Stefan Beller <sbeller@google.com>
Date
Dec 8, 2017, 21:11 UTC
Message-ID
<CAGZ79kbE9ePfxdD+rxp=P_jZwv4RPiVSbhdpjEf48dAMsKWYrQ@mail.gmail.com>
In-Reply-To
<xmqq1sk5b6rx.fsf@gitster.mtv.corp.google.com>
Show 11 quoted lines
>> +
>> +             if ((DIFF_FILE_VALID(p->one) &&
>> +                  oidset_contains(options->blobfind, &p->one->oid)) ||
>> +                 (DIFF_FILE_VALID(p->two) &&
>> +                  oidset_contains(options->blobfind, &p->two->oid))) {
>
> Shouldn't this make sure that !DIFF_PAIR_UNMERGED(p) before looking
> at the sides of the pair?  I think an unmerged pair is queued with
> filespecs whose modes are cleared, but we should not be relying on
> that---I think we even had bugs we fixed by introducing an explicit
> is_unmerged field to the filepair struct.

I am not sure I follow. IIUC 'unmerged' only ever happens in the index when there are multiple stages for one path (represented in the working tree with diff markers). Aren't we supposed to find such an unmerged blob as well (despite wrong mode, but the oid ought to fit)?

Show 9 quoted lines
>> +     if (revs->diffopt.blobfind)
>> +             revs->simplify_history = 0;
>>       return 0;
>>  }
>
> It makes sense to clear this bit by default, but is this an
> unconditonal clearing?  In other words, is there a way for the user
> to countermand this default and ask for merge simplification from
> the command line, e.g. "diff --simplify-history --blobfind=<blob>"?

As noted in your reply, this is consistent with other occurrences of simplify_history, so let's keep it this way.

Show 7 quoted lines
>> +
>> +     git log --abbrev=12 --oneline --blobfind=greeting^{blob} >actual.raw &&
>> +     cut -c 14- actual.raw >actual &&
>> +     test_cmp expect actual
>
> The hardcoded numbers look strange and smell like a workaround of
> not asking for full object names.

You mean the 12 and 14 ? Yeah I can fix that to 40 and 42 if you want. I wrote it this way to be agnostic of the actual object id, but thought 12 would be enough for this test no matter the future hash.

> Also, now it has the simplify-history bit in the change, don't we
> want to check a mergy history, and also running "diff-files" while
> the index has unmerged entries?
yup, I am working on that.
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 25 in “diffcore-blobfind”
  1. 0/1 diffcore-blobfindStefan Beller, Dec 8, 2017
  2. 1/1 diffcore: add a filter to find a specific blobStefan Beller, Dec 8, 2017
  3. Jeff KingDec 8, 2017
  4. Ramsay JonesDec 8, 2017
  5. Jeff KingDec 8, 2017
  6. Stefan BellerDec 8, 2017
  7. Jeff KingDec 8, 2017
  8. Junio C HamanoDec 8, 2017
  9. Junio C HamanoDec 8, 2017
  10. Stefan BellerDec 8, 2017
  11. Junio C HamanoDec 8, 2017
  12. 0/1 diff-core blobfindStefan Beller, Dec 11, 2017
  13. 1/1 diffcore: add a filter to find a specific blobStefan Beller, Dec 11, 2017
  14. Junio C HamanoDec 11, 2017
  15. Stefan BellerDec 12, 2017
  16. diffcore: add a filter to find a specific blobStefan Beller, Dec 12, 2017
  17. Junio C HamanoDec 12, 2017
  18. Jonathan NiederDec 14, 2017
  19. Stefan BellerDec 14, 2017
  20. Jonathan NiederDec 14, 2017
  21. Junio C HamanoDec 15, 2017
  22. Stefan BellerDec 27, 2017
  23. Jonathan NiederDec 27, 2017
  24. Junio C HamanoDec 27, 2017
  25. Junio C HamanoDec 14, 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.