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-forwardingmaint
commit
7a9ae6d0d9
|
@ -1038,14 +1038,13 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
|
||||||
oidclr(&orig_head);
|
oidclr(&orig_head);
|
||||||
|
|
||||||
if (opt_rebase) {
|
if (opt_rebase) {
|
||||||
int autostash = config_autostash;
|
if (opt_autostash == -1)
|
||||||
if (opt_autostash != -1)
|
opt_autostash = config_autostash;
|
||||||
autostash = opt_autostash;
|
|
||||||
|
|
||||||
if (is_null_oid(&orig_head) && !is_cache_unborn())
|
if (is_null_oid(&orig_head) && !is_cache_unborn())
|
||||||
die(_("Updating an unborn branch with changes added to the index."));
|
die(_("Updating an unborn branch with changes added to the index."));
|
||||||
|
|
||||||
if (!autostash)
|
if (!opt_autostash)
|
||||||
require_clean_work_tree(the_repository,
|
require_clean_work_tree(the_repository,
|
||||||
N_("pull with rebase"),
|
N_("pull with rebase"),
|
||||||
_("please commit or stash them."), 1, 0);
|
_("please commit or stash them."), 1, 0);
|
||||||
|
|
|
@ -330,6 +330,19 @@ test_expect_success '--rebase --autostash fast forward' '
|
||||||
test_cmp_rev HEAD to-rebase-ff
|
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_expect_success '--rebase with conflicts shows advice' '
|
||||||
test_when_finished "git rebase --abort; git checkout -f to-rebase" &&
|
test_when_finished "git rebase --abort; git checkout -f to-rebase" &&
|
||||||
git checkout -b seq &&
|
git checkout -b seq &&
|
||||||
|
|
Loading…
Reference in New Issue