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

[PATCH v2 1/6] stash: Add tests for passing in too many refs

From
Joel Teichroeb <joel@teichroeb.net>
Date
Mar 26, 2018, 01:14 UTC
Message-ID
<20180326011426.19159-2-joel@teichroeb.net>
In-Reply-To
<20180326011426.19159-1-joel@teichroeb.net>
Signed-off-by: Joel Teichroeb <joel@teichroeb.net>
---
 t/t3903-stash.sh | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index aefde7b172..7146e27bb5 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -45,6 +45,12 @@ test_expect_success 'applying bogus stash does nothing' '
 	test_cmp expect file
 '
 
+test_expect_success 'applying with too many agruments does nothing' '
+	test_must_fail git stash apply stash@{0} bar &&
+	echo 1 >expect &&
+	test_cmp expect file
+'
+
 test_expect_success 'apply does not need clean working directory' '
 	echo 4 >other-file &&
 	git stash apply &&
@@ -97,6 +103,10 @@ test_expect_success 'stash drop complains of extra options' '
 	test_must_fail git stash drop --foo
 '
 
+test_expect_success 'stash drop complains with too many refs' '
+	test_must_fail git stash drop stash@{1} stash@{2}
+'
+
 test_expect_success 'drop top stash' '
 	git reset --hard &&
 	git stash list > stashlist1 &&
@@ -160,6 +170,10 @@ test_expect_success 'stash pop' '
 	test 0 = $(git stash list | wc -l)
 '
 
+test_expect_success 'stash pop complains with too many refs' '
+	test_must_fail git stash pop stash@{1} stash@{2}
+'
+
 cat > expect << EOF
 diff --git a/file2 b/file2
 new file mode 100644
@@ -479,6 +493,10 @@ test_expect_success 'stash branch - stashes on stack, stash-like argument' '
 	test $(git ls-files --modified | wc -l) -eq 1
 '
 
+test_expect_success 'stash branch complains with too many refs' '
+	test_must_fail git stash branch stash-branch stash@{1} stash@{2}
+'
+
 test_expect_success 'stash show format defaults to --stat' '
 	git stash clear &&
 	test_when_finished "git reset --hard HEAD" &&
@@ -567,6 +585,10 @@ test_expect_success 'stash show -p - no stashes on stack, stash-like argument' '
 	test_cmp expected actual
 '
 
+test_expect_success 'stash show complains with too many refs' '
+	test_must_fail git stash show stash@{1} stash@{2}
+'
+
 test_expect_success 'stash drop - fail early if specified stash is not a stash reference' '
 	git stash clear &&
 	test_when_finished "git reset --hard HEAD && git stash clear" &&
-- 
2.16.2
Previous: Joel TeichroebNext: Johannes Schindelin
Message 2 of 10 in “Convert some stash functionality to a builtin”
  1. 0/6 Convert some stash functionality to a builtinJoel Teichroeb, Mar 26, 2018
  2. 1/6 stash: Add tests for passing in too many refsJoel Teichroeb, Mar 26, 2018
  3. Johannes SchindelinMar 26, 2018
  4. 2/6 stash: Add test for branch with no argumentsJoel Teichroeb, Mar 26, 2018
  5. 4/6 stash: convert drop and clear to builtinJoel Teichroeb, Mar 26, 2018
  6. 5/6 stash: convert branch to builtinJoel Teichroeb, Mar 26, 2018
  7. 6/6 stash: convert pop to builtinJoel Teichroeb, Mar 26, 2018
  8. 3/6 stash: convert apply to builtinJoel Teichroeb, Mar 26, 2018
  9. Christian CouderMar 26, 2018
  10. Joel TeichroebMar 28, 2018

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.