Skip to content

Commit

Permalink
detached-stash: work around git rev-parse failure to detect bad log refs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jon Seymour authored and Junio C Hamano committed Aug 22, 2010
1 parent ef76312 commit b0f0ecd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b0f0ecd

Please sign in to comment.