Alban reported[1] that he expected merge to have an --autostash option, just like rebase. Since there's not really any reason why merge can't have it, let's implement it in this patchset. The majority of this patchset is spent refactoring. This is so that the actual implementation in merge is done as simply as possible. Changes since v1: * Completely changed how the refactoring was done * More tests and documentation [1]: https://github.com/gitgitgadget/git/issues/394 Denton Liu (17): Makefile: alphabetically sort += lists t7600: use test_write_lines() sequencer: use file strbuf for read_oneliner() sequencer: configurably warn on non-existent files sequencer: make read_oneliner() extern rebase: use read_oneliner() sequencer: make apply_rebase() accept a path rebase: use apply_autostash() from sequencer.c rebase: generify reset_head() reset: extract reset_head() from rebase rebase: extract create_autostash() rebase: generify create_autostash() sequencer: extract perform_autostash() from rebase sequencer: unlink autostash in apply_autostash() merge: teach --autostash option t5520: make test_pull_autostash() accept expect_parent_num pull: pass --autostash to merge Documentation/config/merge.txt | 10 ++ Documentation/git-pull.txt | 9 - Documentation/merge-options.txt | 8 + Makefile | 76 ++++---- branch.c | 1 + builtin/commit.c | 2 + builtin/merge.c | 17 ++ builtin/pull.c | 9 +- builtin/rebase.c | 295 ++++---------------------------- path.c | 1 + path.h | 4 +- reset.c | 140 +++++++++++++++ reset.h | 20 +++ sequencer.c | 128 +++++++++----- sequencer.h | 15 ++ t/t3033-merge-toplevel.sh | 22 +++ t/t5520-pull.sh | 57 ++++-- t/t7600-merge.sh | 87 ++++++++-- 18 files changed, 522 insertions(+), 379 deletions(-) create mode 100644 reset.c create mode 100644 reset.h -- 2.24.1.810.g65a2f617f4