]> git.ipfire.org Git - thirdparty/git.git/commit
sequencer: implement save_autostash()
authorDenton Liu <liu.denton@gmail.com>
Tue, 7 Apr 2020 14:28:05 +0000 (10:28 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Apr 2020 16:28:02 +0000 (09:28 -0700)
commit12b6e1367af429628dbaeaa0c7518cacc620d786
treef0c184f39767fe56b556e8269c1736c57c67042d
parent0dd562e0f7c0bb9ca64f1a02265ff5d1be86df34
sequencer: implement save_autostash()

Extract common functionality of apply_autostash() into
apply_save_autostash() and use it to implement save_autostash(). This
function will be used in a future commit.

The difference between save_autostash() and apply_autostash() is that
the former does not try to apply the stash. It skips that step and
just stores the created entry in the stash reflog.

This is useful in the case where we abort an operation when an autostash
is present but we don't want to dirty the worktree with the application
of the stash. For example, in a future commit, we will implement
`git merge --autostash`. Since merges can be aborted using
`git reset --hard`, we'd make use of save_autostash() to save the
autostash entry instead of applying it to the worktree thus keeping the
worktree undirtied.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
sequencer.h