From: Joel Teichroeb <joel@teichroeb.net>
To: Git Mailing List <git@vger.kernel.org>,
Thomas Gummerer <t.gummerer@gmail.com>,
Christian Couder <christian.couder@gmail.com>,
Eric Sunshine <sunshine@sunshineco.com>
Cc: Joel Teichroeb <joel@teichroeb.net>
Subject: [PATCH v2 1/6] stash: Add tests for passing in too many refs
Date: Sun, 25 Mar 2018 18:14:21 -0700 [thread overview]
Message-ID: <20180326011426.19159-2-joel@teichroeb.net> (raw)
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
next prev parent reply other threads:[~2018-03-26 1:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 1:14 [PATCH v2 0/6] Convert some stash functionality to a builtin Joel Teichroeb
2018-03-26 1:14 ` Joel Teichroeb [this message]
2018-03-26 19:21 ` [PATCH v2 1/6] stash: Add tests for passing in too many refs Johannes Schindelin
2018-03-26 1:14 ` [PATCH v2 2/6] stash: Add test for branch with no arguments Joel Teichroeb
2018-03-26 1:14 ` [PATCH v2 3/6] stash: convert apply to builtin Joel Teichroeb
2018-03-26 7:05 ` Christian Couder
2018-03-28 3:32 ` Joel Teichroeb
2018-03-26 1:14 ` [PATCH v2 4/6] stash: convert drop and clear " Joel Teichroeb
2018-03-26 1:14 ` [PATCH v2 5/6] stash: convert branch " Joel Teichroeb
2018-03-26 1:14 ` [PATCH v2 6/6] stash: convert pop " Joel Teichroeb
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180326011426.19159-2-joel@teichroeb.net \
--to=joel@teichroeb.net \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=sunshine@sunshineco.com \
--cc=t.gummerer@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).