git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
D. Ben Knoble <ben.knoble+github@gmail.com>
Date
May 10, 2025, 18:33 UTC
Message-ID
<20250510183358.36806-9-ben.knoble+github@gmail.com>
In-Reply-To
<20250510183358.36806-1-ben.knoble+github@gmail.com>

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@gmail.com>
---
 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
Previous: D. Ben KnobleNext: D. Ben Knoble
Message 9 of 38 in “make stash apply with --index by default”
  1. 0/9 make stash apply with --index by defaultD. Ben Knoble, May 10, 2025
  2. 1/9 t3903: reduce dependencies on previous testsD. Ben Knoble, May 10, 2025
  3. 2/9 t3905: remove unneeded blank lineD. Ben Knoble, May 10, 2025
  4. 3/9 BreakingChanges: announce stash {apply,pop} will imply --indexD. Ben Knoble, May 10, 2025
  5. 4/9 stash: restore the index by default when breaking changes are enabledD. Ben Knoble, May 10, 2025
  6. 5/9 t0450: mark stash documentation as a known discrepancyD. Ben Knoble, May 10, 2025
  7. 6/9 t3903: adjust stash test to account for --[no-]index with breaking changesD. Ben Knoble, May 10, 2025
  8. 7/9 t3904: adjust stash -p test to account for index states with breaking changesD. Ben Knoble, May 10, 2025
  9. 8/9 t3905: adjust stash -u tests for breaking changesD. Ben Knoble, May 10, 2025
  10. 9/9 t3906: adjust stash submodule tests to account for breaking changesD. Ben Knoble, May 10, 2025
  11. Junio C HamanoMay 12, 2025
  12. D. Ben KnobleMay 20, 2025
  13. D. Ben KnobleMay 20, 2025
  14. 0/4 Teach git-stash to use --index from configD. Ben Knoble, Sep 16, 2025
  15. 1/4 t3903: reduce dependencies on previous testsD. Ben Knoble, Sep 16, 2025
  16. 2/4 t3905: remove unneeded blank lineD. Ben Knoble, Sep 16, 2025
  17. 3/4 stash: refactor private config globalsD. Ben Knoble, Sep 16, 2025
  18. 4/4 stash: honor stash.index in apply, pop modesD. Ben Knoble, Sep 16, 2025
  19. Phillip WoodSep 16, 2025
  20. D. Ben KnobleSep 16, 2025
  21. Phillip WoodSep 16, 2025
  22. D. Ben KnobleSep 16, 2025
  23. Junio C HamanoSep 16, 2025
  24. 0/4 Teach git-stash to use --index from configD. Ben Knoble, Sep 22, 2025
  25. 1/4 t3903: reduce dependencies on previous testsD. Ben Knoble, Sep 22, 2025
  26. 2/4 t3905: remove unneeded blank lineD. Ben Knoble, Sep 22, 2025
  27. 3/4 stash: refactor private config globalsD. Ben Knoble, Sep 22, 2025
  28. 4/4 stash: honor stash.index in apply, pop modesD. Ben Knoble, Sep 22, 2025
  29. Phillip WoodSep 22, 2025
  30. D. Ben KnobleSep 24, 2025
  31. Phillip WoodSep 29, 2025
  32. doc: explain the impact of stash.index on --autostash optionsD. Ben Knoble, Oct 6, 2025
  33. Kristoffer HaugsbakkOct 9, 2025
  34. D. Ben KnobleOct 11, 2025
  35. Junio C HamanoOct 11, 2025
  36. Ben KnobleOct 12, 2025
  37. Kristoffer HaugsbakkOct 13, 2025
  38. D. Ben KnobleOct 14, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.