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

[PATCH v2 3/4] t2203: add a test about "diff HEAD" case

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
May 26, 2018, 12:08 UTC
Message-ID
<20180526120846.23663-4-pclouds@gmail.com>
In-Reply-To
<20180526120846.23663-1-pclouds@gmail.com>

Previous attempts to fix ita-related diffs breaks this case. To make sure that does not happen again, add a test to verify the behavior wrt. ita entries when we diff a worktree and a tree.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 t/t2203-add-intent.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh
index 1115347712..546fead6ad 100755
--- a/t/t2203-add-intent.sh
+++ b/t/t2203-add-intent.sh
@@ -245,4 +245,21 @@ test_expect_success 'diff-files/diff-cached shows ita as new/not-new files' '
 	test_cmp expected2 actual2
 '
 
+test_expect_success '"diff HEAD" includes ita as new files' '
+	git reset --hard &&
+	echo new >new-ita &&
+	git add -N new-ita &&
+	git diff HEAD >actual &&
+	cat >expected <<-\EOF &&
+	diff --git a/new-ita b/new-ita
+	new file mode 100644
+	index 0000000..3e75765
+	--- /dev/null
+	+++ b/new-ita
+	@@ -0,0 +1 @@
+	+new
+	EOF
+	test_cmp expected actual
+'
+
 test_done
-- 
2.17.0.705.g3525833791
Previous: Eric SunshineNext: Nguyễn Thái Ngọc Duy
Message 14 of 15 in “diff: turn --ita-invisible-in-index on by default”
  1. 1/2 diff: turn --ita-invisible-in-index on by defaultNguyễn Thái Ngọc Duy, May 13, 2018
  2. 2/2 apply: add --intent-to-addNguyễn Thái Ngọc Duy, May 13, 2018
  3. Junio C HamanoMay 14, 2018
  4. Duy NguyenMay 20, 2018
  5. Junio C HamanoMay 21, 2018
  6. Jonathan NiederMay 25, 2018
  7. Duy NguyenMay 25, 2018
  8. Jonathan NiederMay 25, 2018
  9. Duy NguyenMay 25, 2018
  10. 0/4 Fix i-t-a entries in git-diff and git-applyNguyễn Thái Ngọc Duy, May 26, 2018
  11. 2/4 diff: turn --ita-invisible-in-index on by defaultNguyễn Thái Ngọc Duy, May 26, 2018
  12. 1/4 diff: ignore --ita-[in]visible-in-index when diffing worktree-to-treeNguyễn Thái Ngọc Duy, May 26, 2018
  13. Eric SunshineMay 27, 2018
  14. 3/4 t2203: add a test about "diff HEAD" caseNguyễn Thái Ngọc Duy, May 26, 2018
  15. 4/4 apply: add --intent-to-addNguyễn Thái Ngọc Duy, May 26, 2018

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.