diff options
author | David Turner <dturner@twopensource.com> | 2015-07-21 17:04:56 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-07-21 14:08:49 -0700 |
commit | 89dea973349769efa8facc6f7b11095958205d4d (patch) | |
tree | ddd570b088081e3224e5f74f1b0f02035eded08c /git-stash.sh | |
parent | 144c76fa39254903cb1e8e2d6d159603077356a7 (diff) | |
download | git-89dea973349769efa8facc6f7b11095958205d4d.tar.gz |
git-stash: use update-ref --create-reflog instead of creating filesdt/refs-backend-preamble
This is in support of alternate ref backends which don't necessarily
store reflogs as files.
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-x | git-stash.sh | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/git-stash.sh b/git-stash.sh index 8e9e2cd7d5..1d5ba7a4f9 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -183,9 +183,7 @@ store_stash () { stash_msg="Created via \"git stash store\"." fi - # Make sure the reflog for stash is kept. - : >>"$(git rev-parse --git-path 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 rev-parse --git-path logs/$ref_stash)" || + git reflog exists $ref_stash || clear_stash || die "$(gettext "Cannot initialize stash")" create_stash "$stash_msg" $untracked |