diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-02-05 09:42:28 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-02-05 09:42:28 -0800 |
| commit | 7a9ae6d0d9cf979a2b1a018135370dd6331e505c (patch) | |
| tree | fb90a763cce57ab47ce43d6157d41917eef56a1e | |
| parent | 5d01301f2b865aa8dba1654d3f447ce9d21db0b5 (diff) | |
| parent | 3013d98d7a09b42a111a355db286e72ee03b2e94 (diff) | |
| download | git-7a9ae6d0d9cf979a2b1a018135370dd6331e505c.tar.gz | |
Merge branch 'pb/pull-rebase-autostash-fix'
"git pull --rebase" ignored the rebase.autostash configuration
variable when the remote history is a descendant of our history,
which has been corrected.
* pb/pull-rebase-autostash-fix:
pull --rebase: honor rebase.autostash when fast-forwarding
| -rw-r--r-- | builtin/pull.c | 7 | ||||
| -rwxr-xr-x | t/t5520-pull.sh | 13 |
2 files changed, 16 insertions, 4 deletions
diff --git a/builtin/pull.c b/builtin/pull.c index 100cbf9fb8..8f37880a48 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -1038,14 +1038,13 @@ int cmd_pull(int argc, const char **argv, const char *prefix) oidclr(&orig_head); if (opt_rebase) { - int autostash = config_autostash; - if (opt_autostash != -1) - autostash = opt_autostash; + if (opt_autostash == -1) + opt_autostash = config_autostash; if (is_null_oid(&orig_head) && !is_cache_unborn()) die(_("Updating an unborn branch with changes added to the index.")); - if (!autostash) + if (!opt_autostash) require_clean_work_tree(the_repository, N_("pull with rebase"), _("please commit or stash them."), 1, 0); diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 93ecfcdd24..081808009b 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -330,6 +330,19 @@ test_expect_success '--rebase --autostash fast forward' ' test_cmp_rev HEAD to-rebase-ff ' +test_expect_success '--rebase with rebase.autostash succeeds on ff' ' + test_when_finished "rm -fr src dst actual" && + git init src && + test_commit -C src "initial" file "content" && + git clone src dst && + test_commit -C src --printf "more_content" file "more content\ncontent\n" && + echo "dirty" >>dst/file && + test_config -C dst rebase.autostash true && + git -C dst pull --rebase >actual 2>&1 && + grep -q "Fast-forward" actual && + grep -q "Applied autostash." actual +' + test_expect_success '--rebase with conflicts shows advice' ' test_when_finished "git rebase --abort; git checkout -f to-rebase" && git checkout -b seq && |
