Merge branch 'dl/merge-autostash-rebase-quit-fix'
The stash entry created by "git rebase --autosquash" to keep the initial dirty state were discarded by mistake upon "git rebase --quit", which has been corrected. * dl/merge-autostash-rebase-quit-fix: rebase: save autostash entry into stash reflog on --quitmaint
commit
3afdeef33e
|
@ -256,7 +256,8 @@ See also INCOMPATIBLE OPTIONS below.
|
||||||
--quit::
|
--quit::
|
||||||
Abort the rebase operation but HEAD is not reset back to the
|
Abort the rebase operation but HEAD is not reset back to the
|
||||||
original branch. The index and working tree are also left
|
original branch. The index and working tree are also left
|
||||||
unchanged as a result.
|
unchanged as a result. If a temporary stash entry was created
|
||||||
|
using --autostash, it will be saved to the stash reflog.
|
||||||
|
|
||||||
--apply:
|
--apply:
|
||||||
Use applying strategies to rebase (calling `git-am`
|
Use applying strategies to rebase (calling `git-am`
|
||||||
|
|
|
@ -1566,6 +1566,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
case ACTION_QUIT: {
|
case ACTION_QUIT: {
|
||||||
|
save_autostash(state_dir_path("autostash", &options));
|
||||||
if (options.type == REBASE_MERGE) {
|
if (options.type == REBASE_MERGE) {
|
||||||
struct replay_opts replay = REPLAY_OPTS_INIT;
|
struct replay_opts replay = REPLAY_OPTS_INIT;
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,26 @@ testrebase () {
|
||||||
git checkout feature-branch
|
git checkout feature-branch
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success "rebase$type: --quit" '
|
||||||
|
test_config rebase.autostash true &&
|
||||||
|
git reset --hard &&
|
||||||
|
git checkout -b rebased-feature-branch feature-branch &&
|
||||||
|
test_when_finished git branch -D rebased-feature-branch &&
|
||||||
|
echo dirty >>file3 &&
|
||||||
|
git diff >expect &&
|
||||||
|
test_must_fail git rebase$type related-onto-branch &&
|
||||||
|
test_path_is_file $dotest/autostash &&
|
||||||
|
test_path_is_missing file3 &&
|
||||||
|
git rebase --quit &&
|
||||||
|
test_when_finished git stash drop &&
|
||||||
|
test_path_is_missing $dotest/autostash &&
|
||||||
|
! grep dirty file3 &&
|
||||||
|
git stash show -p >actual &&
|
||||||
|
test_cmp expect actual &&
|
||||||
|
git reset --hard &&
|
||||||
|
git checkout feature-branch
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success "rebase$type: non-conflicting rebase, conflicting stash" '
|
test_expect_success "rebase$type: non-conflicting rebase, conflicting stash" '
|
||||||
test_config rebase.autostash true &&
|
test_config rebase.autostash true &&
|
||||||
git reset --hard &&
|
git reset --hard &&
|
||||||
|
|
Loading…
Reference in New Issue