[PATCH 8/9] t3905: adjust stash -u tests for breaking changes

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

 



Like previous commits, adjust the expected results of application of
stashes with --no-index as needed, with <pathspec> tests typically
requiring --no-index.

One test (stash pop after save --include-untracked leaves files
untracked again) requires an extra cleanup step: subsequent tests
("stash save -u dirty index" and company) are not expecting "file" to be
dirty in the index, but after "stash pop" it will be. Clean up after
ourselves rather than adjusting later tests.

Signed-off-by: D. Ben Knoble <ben.knoble+github@xxxxxxxxx>
---
 t/t3905-stash-include-untracked.sh | 39 ++++++++++++++++++++++++++++--
 1 file changed, 37 insertions(+), 2 deletions(-)

diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh
index 7704709054..ee6cea49c8 100755
--- a/t/t3905-stash-include-untracked.sh
+++ b/t/t3905-stash-include-untracked.sh
@@ -89,7 +89,7 @@
 	git clean --force --quiet
 '
 
-test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '
+test_expect_success !WITH_BREAKING_CHANGES 'stash pop after save --include-untracked leaves files untracked again' '
 	cat >expect <<-EOF &&
 	 M file
 	?? HEAD
@@ -108,6 +108,26 @@
 	test_cmp untracked_expect untracked/untracked
 '
 
+test_expect_success WITH_BREAKING_CHANGES 'stash pop after save --include-untracked leaves files untracked again' '
+	cat >expect <<-EOF &&
+	MM file
+	?? HEAD
+	?? actual
+	?? expect
+	?? file2
+	?? untracked/
+	EOF
+
+	git stash pop &&
+	test_when_finished "git restore --staged file" &&
+	git status --porcelain >actual &&
+	test_cmp expect actual &&
+	echo 1 >expect_file2 &&
+	test_cmp expect_file2 file2 &&
+	echo untracked >untracked_expect &&
+	test_cmp untracked_expect untracked/untracked
+'
+
 test_expect_success 'clean up untracked/ directory to prepare for next tests' '
 	git clean --force --quiet -d
 '
@@ -206,7 +226,7 @@
 	test_path_is_file foo
 '
 
-test_expect_success 'stash push with $IFS character' '
+test_expect_success !WITH_BREAKING_CHANGES 'stash push with $IFS character' '
 	>"foo bar" &&
 	>foo &&
 	>bar &&
@@ -221,6 +241,21 @@
 	test_path_is_file bar
 '
 
+test_expect_success WITH_BREAKING_CHANGES 'stash push with $IFS character' '
+	>"foo bar" &&
+	>foo &&
+	>bar &&
+	git add foo* &&
+	git stash push --include-untracked -- "foo b*" &&
+	test_path_is_missing "foo bar" &&
+	test_path_is_file foo &&
+	test_path_is_file bar &&
+	git stash pop --no-index &&
+	test_path_is_file "foo bar" &&
+	test_path_is_file foo &&
+	test_path_is_file bar
+'
+
 test_expect_success 'stash previously ignored file' '
 	cat >.gitignore <<-EOF &&
 	ignored
-- 
2.48.1





[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