t2203: add a test about "diff HEAD" case
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>
Nguyễn Thái Ngọc Duy committed
May 26, 2018 at 14:08 UTC
8fc8f05cef9b5a60cc7adbd5cd6ed130a89ca4e1
1 file changed
+17
t/t2203-add-intent.sh
+17
@@ -245,4 +245,21 @@ test_expect_success 'diff-files/diff-cached shows ita as new/not-new files' '
245
test_cmp expected2 actual2
246
'
247
248
+test_expect_success '"diff HEAD" includes ita as new files' '
249
+ git reset --hard &&
250
+ echo new >new-ita &&
251
+ git add -N new-ita &&
252
+ git diff HEAD >actual &&
253
+ cat >expected <<-\EOF &&
254
+ diff --git a/new-ita b/new-ita
255
+ new file mode 100644
256
+ index 0000000..3e75765
257
+ --- /dev/null
258
+ +++ b/new-ita
259
+ @@ -0,0 +1 @@
260
+ +new
261
+ EOF
262
+ test_cmp expected actual
263
+'
264
+
265
test_done