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

Re: [RFC PATCH] unpack-trees.c: handle empty deleted ita files

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 15, 2019, 16:34 UTC
Message-ID
<xmqqtvai4cc4.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAK_rgsGSfL2zQLP59O+PUCLGz0X8c4UQ3Zg=9M+nCww5C+X_gA@mail.gmail.com>
Varun Naik <vcnaik94@gmail.com> writes:
Show 11 quoted lines
> On Tue, Aug 13, 2019 at 1:33 PM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> The original code considered that two entries with the same mode and
>> the same "contents" are the same.  As nobody sane tracks an empty
>> file for an extended span of history, that meant that most of the
>> time, intent-to-add entries, which has the normal mode bits for the
>> blobs (with or without the executable bit) and object name for a
>> zero length blob, would have been judged "different".
>>
>
> I agree, this edge case is really arcane. The rabbit hole was deep :)

In retrospect, perhaps I shouldn't have used the empty-blob SHA-1 for I-T-A entries (instead, perhaps 0{40} or something impossible) when I invented this feature at 39425819 ("git-add --intent-to-add (-N)", 2008-08-21). It made the code to "diff" easier than having to special case comparison between a real blob and an I-T-A entry, but we are paying the price for that laziness with a discussion and a patch like this one.

Show 9 quoted lines
>> So perhaps
>>
>> +       !ce_intent_to_add(a) && !ce_intent_to_add(b) &&
>>
>> i.e. "a cache entry is eligible to be same with something else only
>> when its I-T-A bit is unset".
>>
>
> I decided to follow René's suggestion in response to this. Patch coming soon.

Either is fine as the implementation of the same semantics; I however am not sure if two I-T-A entries should compare "same" or "not same", or if we are better off catching the caller that feeds two I-T-A entries to same() with a BUG().

Thanks.
Previous: Varun NaikNext: Varun Naik
Message 6 of 12 in “unpack-trees.c: handle empty deleted ita files”
  1. unpack-trees.c: handle empty deleted ita filesVarun Naik, Aug 13, 2019
  2. René ScharfeAug 13, 2019
  3. Junio C HamanoAug 13, 2019
  4. René ScharfeAug 14, 2019
  5. Varun NaikAug 15, 2019
  6. Junio C HamanoAug 15, 2019
  7. Varun NaikAug 19, 2019
  8. Junio C HamanoAug 19, 2019
  9. unpack-trees.c: distinguish ita files from empty filesVarun Naik, Aug 15, 2019
  10. René ScharfeAug 15, 2019
  11. unpack-trees.c: distinguish ita files from empty filesVarun Naik, Aug 21, 2019
  12. unpack-trees.c: distinguish ita files from empty filesVarun Naik, Feb 14, 2020

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.