Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builtin/pull.c: use config value of autostash #1179

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion builtin/pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,14 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
die(_("cannot rebase with locally recorded submodule modifications"));

if (can_ff) {
/* we can fast-forward this without invoking rebase */
/*
* We can fast-forward without invoking
* rebase, by calling run_merge(). But we
* have to allow rebase.autostash=true to kick
* in.
*/
if (opt_autostash < 0)
opt_autostash = config_autostash;
opt_ff = "--ff-only";
ret = run_merge();
} else {
Expand Down
12 changes: 12 additions & 0 deletions t/t5521-pull-options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,16 @@ test_expect_success 'git pull --no-verify --verify passed to merge' '
test_must_fail git -C dst pull --no-ff --no-verify --verify
'

test_expect_success 'git pull --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 &&
git -C dst pull --rebase --autostash >actual 2>&1 &&
grep -q "Fast-forward" actual &&
grep -q "Applied autostash." actual
'

test_done