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 3/3] stash: add test for stashing in a detached state
Date: Sat, 19 Aug 2017 13:13:26 -0700	[thread overview]
Message-ID: <20170819201326.6872-3-joel@teichroeb.net> (raw)
In-Reply-To: <20170819201326.6872-1-joel@teichroeb.net>

All that we are really testing here is that the message is
correct when we are not on any branch. All other functionality is
already tested elsewhere.

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

diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 887010c497..3b1ac1971a 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -822,6 +822,18 @@ test_expect_success 'create with multiple arguments for the message' '
 	test_cmp expect actual
 '
 
+test_expect_success 'create in a detached state' '
+	test_when_finished "git checkout master" &&
+	git checkout HEAD~1 &&
+	>foo &&
+	git add foo &&
+	STASH_ID=$(git stash create) &&
+	HEAD_ID=$(git rev-parse --short HEAD) &&
+	echo "WIP on (no branch): ${HEAD_ID} initial" >expect &&
+	git show --pretty=%s -s ${STASH_ID} >actual &&
+	test_cmp expect actual
+'
+
 test_expect_success 'stash -- <pathspec> stashes and restores the file' '
 	>foo &&
 	>bar &&
-- 
2.14.1


  parent 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 ` [PATCH 2/3] stash: Add a test for when apply fails during stash branch Joel Teichroeb
2017-08-19 20:13 ` Joel Teichroeb [this message]
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-3-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).