diff options
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-x | git-stash.sh | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/git-stash.sh b/git-stash.sh index 23bd1d3db2..1d5ba7a4f9 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -20,7 +20,7 @@ require_work_tree cd_to_toplevel TMP="$GIT_DIR/.git-stash.$$" -TMPindex=${GIT_INDEX_FILE-"$GIT_DIR/index"}.stash.$$ +TMPindex=${GIT_INDEX_FILE-"$(git rev-parse --git-path index)"}.stash.$$ trap 'rm -f "$TMP-"* "$TMPindex"' 0 ref_stash=refs/stash @@ -183,9 +183,7 @@ store_stash () { stash_msg="Created via \"git stash store\"." fi - # Make sure the reflog for stash is kept. - : >>"$GIT_DIR/logs/$ref_stash" - git update-ref -m "$stash_msg" $ref_stash $w_commit + git update-ref --create-reflog -m "$stash_msg" $ref_stash $w_commit ret=$? test $ret != 0 && test -z $quiet && die "$(eval_gettext "Cannot update \$ref_stash with \$w_commit")" @@ -262,7 +260,7 @@ save_stash () { say "$(gettext "No local changes to save")" exit 0 fi - test -f "$GIT_DIR/logs/$ref_stash" || + git reflog exists $ref_stash || clear_stash || die "$(gettext "Cannot initialize stash")" create_stash "$stash_msg" $untracked |