Skip to content

Commit 89dea97

Browse files
dturner-twgitster
authored andcommitted
git-stash: use update-ref --create-reflog instead of creating files
This is in support of alternate ref backends which don't necessarily store reflogs as files. Signed-off-by: David Turner <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 144c76f commit 89dea97

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

git-stash.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ store_stash () {
183183
stash_msg="Created via \"git stash store\"."
184184
fi
185185

186-
# Make sure the reflog for stash is kept.
187-
: >>"$(git rev-parse --git-path logs/$ref_stash)"
188-
git update-ref -m "$stash_msg" $ref_stash $w_commit
186+
git update-ref --create-reflog -m "$stash_msg" $ref_stash $w_commit
189187
ret=$?
190188
test $ret != 0 && test -z $quiet &&
191189
die "$(eval_gettext "Cannot update \$ref_stash with \$w_commit")"
@@ -262,7 +260,7 @@ save_stash () {
262260
say "$(gettext "No local changes to save")"
263261
exit 0
264262
fi
265-
test -f "$(git rev-parse --git-path logs/$ref_stash)" ||
263+
git reflog exists $ref_stash ||
266264
clear_stash || die "$(gettext "Cannot initialize stash")"
267265

268266
create_stash "$stash_msg" $untracked

0 commit comments

Comments
 (0)