Skip to content

Commit

Permalink
Revert "git-stash: use git rev-parse -q"
Browse files Browse the repository at this point in the history
This reverts commit 757c7f6 as an
unnecessary error message to pop up when the last stash entry is dropped.

It simply is not worth the aggravation.
  • Loading branch information
Junio C Hamano committed Dec 8, 2008
1 parent 0516cc5 commit 0e32126
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ clear_stash () {
then
die "git stash clear with parameters is unimplemented"
fi
if current=$(git rev-parse -q --verify $ref_stash)
if current=$(git rev-parse --verify $ref_stash 2>/dev/null)
then
git update-ref -d $ref_stash $current
fi
Expand Down Expand Up @@ -129,7 +129,7 @@ save_stash () {
}

have_stash () {
git rev-parse -q --verify $ref_stash >/dev/null
git rev-parse --verify $ref_stash >/dev/null 2>&1
}

list_stash () {
Expand Down Expand Up @@ -229,16 +229,16 @@ drop_stash () {
fi
# Verify supplied argument looks like a stash entry
s=$(git rev-parse --verify "$@") &&
git rev-parse -q --verify "$s:" > /dev/null &&
git rev-parse -q --verify "$s^1:" > /dev/null &&
git rev-parse -q --verify "$s^2:" > /dev/null ||
git rev-parse --verify "$s:" > /dev/null 2>&1 &&
git rev-parse --verify "$s^1:" > /dev/null 2>&1 &&
git rev-parse --verify "$s^2:" > /dev/null 2>&1 ||
die "$*: not a valid stashed state"

git reflog delete --updateref --rewrite "$@" &&
echo "Dropped $* ($s)" || die "$*: Could not drop stash entry"

# clear_stash if we just dropped the last stash entry
git rev-parse -q --verify "$ref_stash@{0}" > /dev/null || clear_stash
git rev-parse --verify "$ref_stash@{0}" > /dev/null 2>&1 || clear_stash
}

apply_to_branch () {
Expand Down

0 comments on commit 0e32126

Please sign in to comment.