From 7ab3cc70a6aad2e4f8ccaa98e5520aa126eaef8f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 26 Jul 2007 23:24:28 -0700 Subject: [PATCH] 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 --- git-stash.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/git-stash.sh b/git-stash.sh index d9cd42d4b..f90dffd4c 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -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 () { -- 2.30.2