t2203: add a test about "diff HEAD" case
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 26 May 2018 12:08:45 +0000 (14:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 May 2018 03:42:27 +0000 (12:42 +0900)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t2203-add-intent.sh
index 11153477127be2c38a0588606243678ffab56194..546fead6ad31460af1e22d3c6400ad3825b1700f 100755 (executable)
@@ -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