From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gister@pobox.com>
Subject: [PATCH] t3903 (stash): add failing test for ref of form ^{/message}
Date: Tue, 16 Apr 2013 23:37:23 +0530 [thread overview]
Message-ID: <1366135643-18358-1-git-send-email-artagnon@gmail.com> (raw)
While a 'git stash show stash^{/quuxery}' works just fine, a 'git
stash pop stash^{/quuxery}' complains with: 'stash^{/quuxery} is not a
stash reference'. This confusing behavior arises from the differences
in logic that 'show' and 'pop' internally employ to validate the
specified ref. Document this bug by adding a failing testcase for it.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
So if you look at git-stash.sh:377, you'll notice that it's doing a
the shell substitution "${REV%@*}" to figure out whether the stash
ref is a valid ref. This hacky myopic design has to be done away
with immediately, and we should really compare the SHA-1 hex of the
specified ref with those in the stash reflog.
The only reason I haven't written a fix yet is because I'm not sure
why you need this convoluted IS_STASH_LIKE and IS_STASH_REF logic in
the first place. Can someone enlighten me as to what is going on?
t/t3903-stash.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 5dfbda7..04ba983 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -583,6 +583,15 @@ test_expect_success 'invalid ref of the form stash@{n}, n >= N' '
git stash drop
'
+test_expect_failure 'valid ref of the form stash^{/message}' '
+ git stash clear &&
+ echo bar > file &&
+ git add file &&
+ git stash save "quuxery" &&
+ git stash show stash^{/quuxery} &&
+ git stash pop stash^{/quuxery}
+'
+
test_expect_success 'stash branch should not drop the stash if the branch exists' '
git stash clear &&
echo foo >file &&
--
1.8.2.1.390.g924f6c3.dirty
reply other threads:[~2013-04-16 18:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1366135643-18358-1-git-send-email-artagnon@gmail.com \
--to=artagnon@gmail.com \
--cc=gister@pobox.com \
--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).