From: "D. Ben Knoble" <ben.knoble+github@gmail.com>
To: git@vger.kernel.org
Cc: "D. Ben Knoble" <ben.knoble+github@gmail.com>,
Denton Liu <liu.denton@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 8/9] t3905: adjust stash -u tests for breaking changes
Date: Sat, 10 May 2025 14:33:43 -0400 [thread overview]
Message-ID: <20250510183358.36806-9-ben.knoble+github@gmail.com> (raw)
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
next prev parent reply other threads:[~2025-05-10 18:34 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-10 18:33 [PATCH 0/9] make stash apply with --index by default D. Ben Knoble
2025-05-10 18:33 ` [PATCH 1/9] t3903: reduce dependencies on previous tests D. Ben Knoble
2025-05-10 18:33 ` [PATCH 2/9] t3905: remove unneeded blank line D. Ben Knoble
2025-05-10 18:33 ` [PATCH 3/9] BreakingChanges: announce stash {apply,pop} will imply --index D. Ben Knoble
2025-05-10 18:33 ` [PATCH 4/9] stash: restore the index by default when breaking changes are enabled D. Ben Knoble
2025-05-10 18:33 ` [PATCH 5/9] t0450: mark stash documentation as a known discrepancy D. Ben Knoble
2025-05-10 18:33 ` [PATCH 6/9] t3903: adjust stash test to account for --[no-]index with breaking changes D. Ben Knoble
2025-05-10 18:33 ` [PATCH 7/9] t3904: adjust stash -p test to account for index states " D. Ben Knoble
2025-05-10 18:33 ` D. Ben Knoble [this message]
2025-05-10 18:33 ` [PATCH 9/9] t3906: adjust stash submodule tests to account for " D. Ben Knoble
2025-05-12 12:52 ` [PATCH 0/9] make stash apply with --index by default Junio C Hamano
2025-05-20 14:36 ` D. Ben Knoble
2025-05-20 14:39 ` D. Ben Knoble
2025-09-16 0:37 ` [PATCH v2 0/4] Teach git-stash to use --index from config D. Ben Knoble
2025-09-16 0:37 ` [PATCH v2 1/4] t3903: reduce dependencies on previous tests D. Ben Knoble
2025-09-16 0:37 ` [PATCH v2 2/4] t3905: remove unneeded blank line D. Ben Knoble
2025-09-16 0:37 ` [PATCH v2 3/4] stash: refactor private config globals D. Ben Knoble
2025-09-16 0:37 ` [PATCH v2 4/4] stash: honor stash.index in apply, pop modes D. Ben Knoble
2025-09-16 9:18 ` Phillip Wood
2025-09-16 17:07 ` D. Ben Knoble
2025-09-16 9:24 ` [PATCH v2 0/4] Teach git-stash to use --index from config Phillip Wood
2025-09-16 17:06 ` D. Ben Knoble
2025-09-16 16:49 ` Junio C Hamano
2025-09-22 1:39 ` [PATCH v3 " D. Ben Knoble
2025-09-22 1:39 ` [PATCH v3 1/4] t3903: reduce dependencies on previous tests D. Ben Knoble
2025-09-22 1:39 ` [PATCH v3 2/4] t3905: remove unneeded blank line D. Ben Knoble
2025-09-22 1:39 ` [PATCH v3 3/4] stash: refactor private config globals D. Ben Knoble
2025-09-22 1:39 ` [PATCH v3 4/4] stash: honor stash.index in apply, pop modes D. Ben Knoble
2025-09-22 14:11 ` Phillip Wood
2025-09-24 20:40 ` D. Ben Knoble
2025-09-29 10:01 ` Phillip Wood
2025-10-06 12:59 ` [PATCH] doc: explain the impact of stash.index on --autostash options D. Ben Knoble
2025-10-09 22:54 ` Kristoffer Haugsbakk
2025-10-11 14:44 ` D. Ben Knoble
2025-10-11 17:28 ` Junio C Hamano
2025-10-12 18:04 ` Ben Knoble
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250510183358.36806-9-ben.knoble+github@gmail.com \
--to=ben.knoble+github@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=liu.denton@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).