Skip to content

Commit

Permalink
git-stash: do not remove a ref by hand.
Browse files Browse the repository at this point in the history
Somebody on #git noticed that "git stash clear" left a packed
ref behind for ref/stash.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Jul 27, 2007
1 parent 383e45c commit 7ab3cc7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ no_changes () {
}

clear_stash () {
logfile="$GIT_DIR/logs/$ref_stash" &&
mkdir -p "$(dirname "$logfile")" &&
: >"$logfile"
if current=$(git rev-parse --verify $ref_stash 2>/dev/null)
then
git update-ref -d refs/stash $current
fi
}

save_stash () {
Expand Down

0 comments on commit 7ab3cc7

Please sign in to comment.