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

[PATCH 1/2] t3420: prepare for reftable

From
Han-Wen Nienhuys via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 8, 2022, 20:09 UTC
Message-ID
<fc1bd0621085f331b804c83df7a03cb1d4872fcd.1644350985.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1214.git.git.1644350985.gitgitgadget@gmail.com>
From: Han-Wen Nienhuys <hanwen@google.com>

Check for autostash existence using rev-parse; remove the autostash using test-tool.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 t/t3420-rebase-autostash.sh | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 43fcb68f27e..e6466290e03 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -79,7 +79,7 @@ create_expected_failure_merge () {
 
 testrebase () {
 	type=$1
-	dotest=$2
+	test_type=$2
 
 	test_expect_success "rebase$type: dirty worktree, --no-autostash" '
 		test_config rebase.autostash true &&
@@ -133,9 +133,10 @@ testrebase () {
 		test_when_finished git branch -D rebased-feature-branch &&
 		echo dirty >>file3 &&
 		test_must_fail git rebase$type related-onto-branch &&
-		test_path_is_file $dotest/autostash &&
+		git rev-parse $test_type/autostash &&
 		test_path_is_missing file3 &&
-		rm -rf $dotest &&
+		test-tool ref-store main delete-refs REF_SKIP_REFNAME_VERIFICATION msg $test_type/autostash &&
+		rm -rf .git/$test_type &&
 		git reset --hard &&
 		git checkout feature-branch
 	'
@@ -147,12 +148,12 @@ testrebase () {
 		test_when_finished git branch -D rebased-feature-branch &&
 		echo dirty >>file3 &&
 		test_must_fail git rebase$type related-onto-branch &&
-		test_path_is_file $dotest/autostash &&
+		git rev-parse $test_type/autostash &&
 		test_path_is_missing file3 &&
 		echo "conflicting-plus-goodbye" >file2 &&
 		git add file2 &&
 		git rebase --continue &&
-		test_path_is_missing $dotest/autostash &&
+		test_must_fail git rev-parse $test_type/autostash &&
 		grep dirty file3 &&
 		git checkout feature-branch
 	'
@@ -164,10 +165,10 @@ testrebase () {
 		test_when_finished git branch -D rebased-feature-branch &&
 		echo dirty >>file3 &&
 		test_must_fail git rebase$type related-onto-branch &&
-		test_path_is_file $dotest/autostash &&
+		git rev-parse $test_type/autostash &&
 		test_path_is_missing file3 &&
 		git rebase --skip &&
-		test_path_is_missing $dotest/autostash &&
+		test_must_fail git rev-parse $test_type/autostash &&
 		grep dirty file3 &&
 		git checkout feature-branch
 	'
@@ -179,10 +180,10 @@ testrebase () {
 		test_when_finished git branch -D rebased-feature-branch &&
 		echo dirty >>file3 &&
 		test_must_fail git rebase$type related-onto-branch &&
-		test_path_is_file $dotest/autostash &&
+		git rev-parse $test_type/autostash &&
 		test_path_is_missing file3 &&
 		git rebase --abort &&
-		test_path_is_missing $dotest/autostash &&
+		test_must_fail git rev-parse $test_type/autostash &&
 		grep dirty file3 &&
 		git checkout feature-branch
 	'
@@ -195,11 +196,11 @@ testrebase () {
 		echo dirty >>file3 &&
 		git diff >expect &&
 		test_must_fail git rebase$type related-onto-branch &&
-		test_path_is_file $dotest/autostash &&
+		git rev-parse $test_type/autostash &&
 		test_path_is_missing file3 &&
 		git rebase --quit &&
 		test_when_finished git stash drop &&
-		test_path_is_missing $dotest/autostash &&
+		test_must_fail git rev-parse $test_type/autostash &&
 		! grep dirty file3 &&
 		git stash show -p >actual &&
 		test_cmp expect actual &&
@@ -214,7 +215,7 @@ testrebase () {
 		echo dirty >file4 &&
 		git add file4 &&
 		git rebase$type unrelated-onto-branch >actual 2>&1 &&
-		test_path_is_missing $dotest &&
+		test_must_fail git rev-parse $test_type/autostash &&
 		git reset --hard &&
 		grep unrelated file4 &&
 		! grep dirty file4 &&
@@ -257,9 +258,9 @@ test_expect_success "rebase: noop rebase" '
 	git checkout feature-branch
 '
 
-testrebase " --apply" .git/rebase-apply
-testrebase " --merge" .git/rebase-merge
-testrebase " --interactive" .git/rebase-merge
+testrebase " --apply" rebase-apply
+testrebase " --merge" rebase-merge
+testrebase " --interactive" rebase-merge
 
 test_expect_success 'abort rebase -i with --autostash' '
 	test_when_finished "git reset --hard" &&
-- 
gitgitgadget
Previous: Han-Wen Nienhuys via GitGitGadgetNext: Han-Wen Nienhuys via GitGitGadget
Message 2 of 3 in “Prepare (auto)stash for reftable”
  1. 0/2 Prepare (auto)stash for reftableHan-Wen Nienhuys via GitGitGadget, Feb 8, 2022
  2. 1/2 t3420: prepare for reftableHan-Wen Nienhuys via GitGitGadget, Feb 8, 2022
  3. 2/2 Treat MERGE_AUTOSTASH and friends as a pseudorefHan-Wen Nienhuys via GitGitGadget, Feb 8, 2022

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.