summaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorJon Seymour <jon.seymour@gmail.com>2010-08-21 04:48:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-08-22 06:51:21 (GMT)
commitb0f0ecd97924ee775e7f3b29366133448f4f8e15 (patch)
tree113c1e778647679009ac7987c8f5471ae1a72728 /git-stash.sh
parentef763129d105ff2b0501da7cd2ff71e99c89b477 (diff)
downloadgit-b0f0ecd97924ee775e7f3b29366133448f4f8e15.zip
git-b0f0ecd97924ee775e7f3b29366133448f4f8e15.tar.gz
git-b0f0ecd97924ee775e7f3b29366133448f4f8e15.tar.bz2
detached-stash: work around git rev-parse failure to detect bad log refs
This commit is required because git rev-parse in 1.7.2 does not correctly indicate invalid log references using a non-zero status code. We use a proxy for the condition (non-empty error output) as a substitute. This commit can be reverted when, and if, rev-parse is fixed to indicate invalid log references with a status code. Signed-off-by: Jon Seymour <jon.seymour@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-stash.sh b/git-stash.sh
index 836d6e6..42b0da2 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -328,6 +328,15 @@ parse_flags_and_rev()
test "$ref_stash" = "$(git rev-parse --symbolic-full-name "${REV%@*}")" &&
IS_STASH_REF=t
+ if test "${REV}" != "${REV%{*\}}"
+ then
+ # maintainers: it would be better if git rev-parse indicated
+ # this condition with a non-zero status code but as of 1.7.2.1 it
+ # it did not. So, we use non-empty stderr output as a proxy for the
+ # condition of interest.
+ test -z "$(git rev-parse "$REV" 2>&1 >/dev/null)" || die "$REV does not exist in the stash log"
+ fi
+
}
is_stash_like()