diff options
| author | Junio C Hamano <gitster@pobox.com> | 2015-08-03 11:01:29 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2015-08-03 11:01:29 -0700 |
| commit | b6d323f1646d7204fc6693071e5be84377ece70b (patch) | |
| tree | bb917f3763b586c34dc8fb03fb4bc9c8132e4632 /git-stash.sh | |
| parent | 8348bf1b6957e8e75fbfc988ce4e7802ce408d6b (diff) | |
| parent | 89dea973349769efa8facc6f7b11095958205d4d (diff) | |
| download | git-b6d323f1646d7204fc6693071e5be84377ece70b.tar.xz | |
Merge branch 'dt/refs-backend-preamble'
In preparation for allowing different "backends" to store the refs
in a way different from the traditional "one ref per file in $GIT_DIR
or in a $GIT_DIR/packed-refs file" filesystem storage, reduce
direct filesystem access to ref-like things like CHERRY_PICK_HEAD
from scripts and programs.
* dt/refs-backend-preamble:
git-stash: use update-ref --create-reflog instead of creating files
update-ref and tag: add --create-reflog arg
refs: add REF_FORCE_CREATE_REFLOG flag
git-reflog: add exists command
refs: new public ref function: safe_create_reflog
refs: break out check for reflog autocreation
refs.c: add err arguments to reflog functions
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 |
