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

Re: [PATCH v2] diff-lib.c: adjust position of i-t-a entries in diff

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 24, 2015, 01:15 UTC
Message-ID
<CACsJy8BczCNxm3WHK1gtkXiZCbDkFD-67oOMR+eK8uwOBfQXuw@mail.gmail.com>
In-Reply-To
<xmqqlhitle5w.fsf@gitster.dls.corp.google.com>
On Thu, Mar 19, 2015 at 1:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 27 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Ah, wait.
>>
>> I suspect that it all cancels out.
>> ...
>> Now, as you mentioned, there _may_ be codepaths that uses the same
>> definition of "what's in the index" as what diff-cache used to take
>> before your patches, and they may be broken by removing the
>> invalidation.  If we find such codepaths, we should treat their old
>> behaviour as buggy and fix them, instead of reintroducing the
>> invalidation and keep their current behaviour, as the new world
>> order is "i-t-a entries in the index does not yet exist."
>
> One potential negative consequence of the new world order I can
> immediately think of is this.  In many operations, we try to be
> lenient to changes in the working tree as long as the index is
> clean.  "read-tree -m" is the most visible one, where we require
> that the index and HEAD matches while allowing changes to working
> tree paths as long as they do not interfere with the paths that are
> involved in the merge.  We need to make sure that the path dir/bar
> added by "add -N dir/bar", which in the new world order does not
> count as "index is not clean and there is a difference from HEAD",
> (1) does not interfere with the mergy operation that wants to touch
> dir (which _could_ even be expected to be a file) or dir/bar, and
> (2) is not lost because the mergy operation wants to touch dir or
> dir/bar, for example.

"read-tree -m" does not invoke diff, does it? If I went with my previous approach (modifying unpack-trees to ignore i-t-a entries) then this could be a problem, but because unpack-trees is untouched, merge operations should not be impacted by this patch. Even if some other command does "diff --cached" first to abort early, if "diff --cached" fails to report "HEAD and index are different" as you described, I would expect unpack-trees to be able to deal with it anyway.

PS. Sorry for the late response, busy fighting the evil last weekend. I blame Steam on Linux.

-- 
Duy
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 18 in “Bug fixes regarding diff and "git add -N"”
  1. 0/2 Bug fixes regarding diff and "git add -N"Nguyễn Thái Ngọc Duy, Mar 9, 2015
  2. 1/2 diff --cached: do not report i-t-a entries as "new"Nguyễn Thái Ngọc Duy, Mar 9, 2015
  3. Junio C HamanoMar 15, 2015
  4. diff-lib.c: adjust position of i-t-a entries in diffNguyễn Thái Ngọc Duy, Mar 16, 2015
  5. Michael J GruberMar 16, 2015
  6. Junio C HamanoMar 16, 2015
  7. Duy NguyenMar 17, 2015
  8. Junio C HamanoMar 17, 2015
  9. Duy NguyenMar 18, 2015
  10. Junio C HamanoMar 18, 2015
  11. Junio C HamanoMar 19, 2015
  12. Duy NguyenMar 24, 2015
  13. Junio C HamanoMar 24, 2015
  14. Junio C HamanoMar 23, 2015
  15. 2/2 diff-files: mark i-t-a paths as "new"Nguyễn Thái Ngọc Duy, Mar 9, 2015
  16. Junio C HamanoMar 15, 2015
  17. t2203,t4011: adjust to changed intent-to-add treatmentMichael J Gruber, Mar 9, 2015
  18. Junio C HamanoMar 15, 2015

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.