[PATCH] t4069: test diff behavior with i-t-a paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a small test suite to test the behavior of diff with intent-to-add
paths. Specifically, the diff between an i-t-a entry and a file in the
worktree should be a "new file" diff, and the diff between an i-t-a
entry and no file in the worktree should be a "deleted file" diff.
However, if --ita-visible-in-index is passed, the former should instead
be a diff from the empty blob.

Signed-off-by: Raymond E. Pasco <ray@xxxxxxxxxxxx>
---
 t/t4069-diff-intent-to-add.sh | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 t/t4069-diff-intent-to-add.sh

diff --git a/t/t4069-diff-intent-to-add.sh b/t/t4069-diff-intent-to-add.sh
new file mode 100644
index 0000000000..85c1a35ca7
--- /dev/null
+++ b/t/t4069-diff-intent-to-add.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+test_description='behavior of diff with intent-to-add entries'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+	test_write_lines 1 2 3 4 5 >blueprint
+'
+
+test_expect_success 'diff between i-t-a and file should be new file' '
+	cat blueprint >test-file &&
+	git add -N test-file &&
+	git diff >output &&
+	grep "new file mode 100644" output
+'
+
+test_expect_success 'diff between i-t-a and no file should be deletion' '
+	rm -f test-file &&
+	git diff >output &&
+	grep "deleted file mode 100644" output
+'
+
+test_expect_success '--ita-visible-in-index diff should be from empty blob' '
+	cat blueprint >test-file &&
+	git diff --ita-visible-in-index >output &&
+	grep "index e69de29" output
+'
+
+test_done
-- 
2.28.0.3.gc4aba908ca




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux