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

[PATCH 0/3] i-t-a entries in git-status, and git-commit

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Sep 28, 2016, 11:43 UTC
Message-ID
<20160928114348.1470-1-pclouds@gmail.com>

Let's see if I can get the first commit graduated before it turns two years old. Six months to go! This series is about some oddities of intent-to-add entries (aka "git add -N"):

1) An ita entry in git-status shows that it's added in the index
   (compared to worktree) as a file change, not new file addition. And
   it shows the entry added to HEAD as an empty version. This is due
   to an implementation detail that i-t-a entries are registered in
   the index as empty blobs with a special flag.
2) When you do a "git commit" with no changes whatsoever, but you
   happen to have some ita entries registered, git-commit does not
   recognize the resulting commit would be empty and should be caught,
   unless --allow-empty is given. This has been reported several times.
3) Same symptom as 2) but with initial commit (diff code is not used
   for detecting empty commits this time). If you only have ita
   entries in the index by the time you make an initial commit, you'll
   create an empty commit even if --allow-empty is not specified.
1) and 2) are fixed by changing the position of ita entries in diff
code. ita entries should be seen as a new file when compared between
worktree and HEAD, and no change when compared between index and HEAD.

Some previous commit made this move globally and was reverted because it could have dangerous unseen side effects, especially in merge code. Now we are moving slowly towards that (first patch), this time we try to handle case by case (e.g. index_differs_from in the second patch).

3) could be handled pretty easily once you know the problem. This is
the third patch.
Nguyễn Thái Ngọc Duy (3):
  Resurrect "diff-lib.c: adjust position of i-t-a entries in diff"
  diff-lib.c: enable --shift-ita in index_differs_from()
  commit: don't be fooled by ita entries when creating initial commit
 Documentation/diff-options.txt |  7 +++++++
 builtin/commit.c               | 11 ++++++++---
 cache.h                        |  1 +
 diff-lib.c                     | 13 +++++++++++++
 diff.c                         |  2 ++
 diff.h                         |  1 +
 read-cache.c                   | 10 ++++++++++
 sequencer.c                    |  5 +++--
 t/t2203-add-intent.sh          | 41 +++++++++++++++++++++++++++++++++++++++--
 t/t7064-wtstatus-pv2.sh        |  4 ++--
 wt-status.c                    |  7 ++++++-
 11 files changed, 92 insertions(+), 10 deletions(-)
-- 
2.8.2.524.g6ff3d78
Next: Nguyễn Thái Ngọc Duy
Message 1 of 21 in “i-t-a entries in git-status, and git-commit”
  1. 0/3 i-t-a entries in git-status, and git-commitNguyễn Thái Ngọc Duy, Sep 28, 2016
  2. 1/3 Resurrect "diff-lib.c: adjust position of i-t-a entries in diff"Nguyễn Thái Ngọc Duy, Sep 28, 2016
  3. Junio C HamanoSep 28, 2016
  4. Junio C HamanoSep 28, 2016
  5. Duy NguyenOct 3, 2016
  6. Junio C HamanoOct 4, 2016
  7. Duy NguyenOct 5, 2016
  8. Junio C HamanoOct 6, 2016
  9. Duy NguyenOct 7, 2016
  10. Junio C HamanoOct 10, 2016
  11. 2/3 diff-lib.c: enable --shift-ita in index_differs_from()Nguyễn Thái Ngọc Duy, Sep 28, 2016
  12. Junio C HamanoSep 28, 2016
  13. 3/3 commit: don't be fooled by ita entries when creating initial commitNguyễn Thái Ngọc Duy, Sep 28, 2016
  14. Duy NguyenSep 28, 2016
  15. 0/4 nd/ita-empty-commit updateNguyễn Thái Ngọc Duy, Oct 24, 2016
  16. 1/4 diff-lib: allow ita entries treated as "not yet exist in index"Nguyễn Thái Ngọc Duy, Oct 24, 2016
  17. 2/4 diff: add --ita-[in]visible-in-indexNguyễn Thái Ngọc Duy, Oct 24, 2016
  18. 3/4 commit: fix empty commit creation when there's no changes but ita entriesNguyễn Thái Ngọc Duy, Oct 24, 2016
  19. 4/4 commit: don't be fooled by ita entries when creating initial commitNguyễn Thái Ngọc Duy, Oct 24, 2016
  20. Junio C HamanoOct 24, 2016
  21. Duy NguyenOct 25, 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.