Skip to content

Commit 8fc8f05

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0231ae7 commit 8fc8f05

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

t/t2203-add-intent.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,21 @@ test_expect_success 'diff-files/diff-cached shows ita as new/not-new files' '
245245
test_cmp expected2 actual2
246246
'
247247

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+
248265
test_done

0 commit comments

Comments
 (0)