Skip to content

Commit 7ab3cc7

Browse files
committed
git-stash: do not remove a ref by hand.
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>
1 parent 383e45c commit 7ab3cc7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

git-stash.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ no_changes () {
1919
}
2020

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

2728
save_stash () {

0 commit comments

Comments
 (0)