git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Teichroeb <joel@teichroeb.net>
To: git@vger.kernel.org
Cc: Joel Teichroeb <joel@teichroeb.net>
Subject: [PATCH 2/3] stash: Add a test for when apply fails during stash branch
Date: Sat, 19 Aug 2017 13:13:25 -0700	[thread overview]
Message-ID: <20170819201326.6872-2-joel@teichroeb.net> (raw)
In-Reply-To: <20170819201326.6872-1-joel@teichroeb.net>

If the return value of merge recursive is not checked, the stash could end
up being dropped even though it was not applied properly

Signed-off-by: Joel Teichroeb <joel@teichroeb.net>
---
 t/t3903-stash.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index f0708ced27..887010c497 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -656,6 +656,20 @@ test_expect_success 'stash branch should not drop the stash if the branch exists
 	git rev-parse stash@{0} --
 '
 
+test_expect_success 'stash branch should not drop the stash if the apply fails' '
+	git stash clear &&
+	git reset HEAD~1 --hard &&
+	echo foo >file &&
+	git add file &&
+	git commit -m initial &&
+	echo bar >file &&
+	git stash &&
+	echo baz >file &&
+	test_when_finished "git checkout master" &&
+	test_must_fail git stash branch new_branch stash@{0} &&
+	git rev-parse stash@{0} --
+'
+
 test_expect_success 'stash apply shows status same as git status (relative to current directory)' '
 	git stash clear &&
 	echo 1 >subdir/subfile1 &&
-- 
2.14.1


  reply	other threads:[~2017-08-19 20:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-19 20:13 [PATCH 1/3] stash: add test for stash create with no files Joel Teichroeb
2017-08-19 20:13 ` Joel Teichroeb [this message]
2017-08-19 20:13 ` [PATCH 3/3] stash: add test for stashing in a detached state Joel Teichroeb
2017-08-19 20:55 ` [PATCH 1/3] stash: add test for stash create with no files Junio C Hamano
2017-08-19 21:00   ` Joel Teichroeb
2017-08-19 21:07     ` Junio C Hamano

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=20170819201326.6872-2-joel@teichroeb.net \
    --to=joel@teichroeb.net \
    --cc=git@vger.kernel.org \
    /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).