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

Re: [PATCH 2/4] Resurrect "diff-lib.c: adjust position of i-t-a entries in diff"

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 6, 2016, 20:42 UTC
Message-ID
<xmqqtwh6uk0k.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160606111643.7122-3-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 5 quoted lines
> +--shift-ita::
> +	By default entries added by "git add -N" appear as an existing
> +	empty file in "git diff" and a new file in "git diff --cached".
> +	This option makes the entry appear as a new file in "git diff"
> +	and non-existent in "git diff --cached".

I do not think this should exist at the UI level, even though the use of it in wt-status.c (below) makes a very good sense at least as a temporary band-aid.

At the philosophical level, I however think this "I-T-A does not logically exist in the index (yet)" is a mistake, and "an option controls if I-T-A does or does not exist depending on who calls it" is even worse; it is a road to insanity.

For example, because I-T-A does not logically exist in the index, "git reset --hard" should not remove it but make it untracked again (but I do not think it does). After "git add -N foo", because "foo" does not exist in the index, "git clean" should remove it for the definition of what's in the index to be logically consistent, but the whole intent of "add -N" is that the user meant it is worth checking into sometime in the future, which contradicts with its removal upon "clean".

So, I dunno.
Previous: Nguyễn Thái Ngọc DuyNext: Duy Nguyen
Message 7 of 15 in “i-t-a entries again...”
  1. 0/4 i-t-a entries again...Nguyễn Thái Ngọc Duy, Jun 6, 2016
  2. 1/4 diff.h: extend "flags" field to 64 bits because we're out of bitsNguyễn Thái Ngọc Duy, Jun 6, 2016
  3. Junio C HamanoJun 6, 2016
  4. Duy NguyenJun 7, 2016
  5. stefan.naewe@atlas-elektronik.comJun 7, 2016
  6. 2/4 Resurrect "diff-lib.c: adjust position of i-t-a entries in diff"Nguyễn Thái Ngọc Duy, Jun 6, 2016
  7. Junio C HamanoJun 6, 2016
  8. Duy NguyenJun 7, 2016
  9. Johannes SchindelinJun 9, 2016
  10. Duy NguyenSep 27, 2016
  11. Duy NguyenSep 27, 2016
  12. 3/4 commit: don't count i-t-a entries when checking if the new commit is emptyNguyễn Thái Ngọc Duy, Jun 6, 2016
  13. Junio C HamanoJun 6, 2016
  14. Junio C HamanoJun 6, 2016
  15. 4/4 commit: reinstate commit behavior before 3f6d56d via a config optionNguyễn Thái Ngọc Duy, Jun 6, 2016

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.