@@ -252,4 +252,56 @@ test_expect_success 'git pull --no-verify --verify passed to merge' '
252252 test_must_fail git -C dst pull --no-ff --no-verify --verify
253253'
254254
255+ test_expect_success ' git pull --rebase --autostash succeeds on ff' '
256+ test_when_finished "rm -fr src dst actual" &&
257+ git init src &&
258+ test_commit -C src "initial" file "content" &&
259+ git clone src dst &&
260+ test_commit -C src --printf "more_content" file "more content\ncontent\n" &&
261+ echo "dirty" >>dst/file &&
262+ git -C dst pull --rebase --autostash >actual 2>&1 &&
263+ grep -q "Fast-forward" actual &&
264+ grep -q "Applied autostash." actual
265+ '
266+
267+ test_expect_success ' git pull --rebase with rebase.autostash succeeds on ff' '
268+ test_when_finished "rm -fr src dst actual" &&
269+ git init src &&
270+ test_commit -C src "initial" file "content" &&
271+ git clone src dst &&
272+ test_commit -C src --printf "more_content" file "more content\ncontent\n" &&
273+ echo "dirty" >>dst/file &&
274+ test_config -C dst rebase.autostash true &&
275+ git -C dst pull --rebase >actual 2>&1 &&
276+ grep -q "Fast-forward" actual &&
277+ grep -q "Applied autostash." actual
278+ '
279+
280+ test_expect_success ' git pull --rebase --autostash succeeds on non-ff' '
281+ test_when_finished "rm -fr src dst actual" &&
282+ git init src &&
283+ test_commit -C src "initial" file "content" &&
284+ git clone src dst &&
285+ test_commit -C src --printf "src_content" file "src content\ncontent\n" &&
286+ test_commit -C dst --append "dst_content" file "dst content" &&
287+ echo "dirty" >>dst/file &&
288+ git -C dst pull --rebase --autostash >actual 2>&1 &&
289+ grep -q "Successfully rebased and updated refs/heads/main." actual &&
290+ grep -q "Applied autostash." actual
291+ '
292+
293+ test_expect_success ' git pull --rebase with rebase.autostash succeeds on non-ff' '
294+ test_when_finished "rm -fr src dst actual" &&
295+ git init src &&
296+ test_commit -C src "initial" file "content" &&
297+ git clone src dst &&
298+ test_commit -C src --printf "src_content" file "src content\ncontent\n" &&
299+ test_commit -C dst --append "dst_content" file "dst content" &&
300+ echo "dirty" >>dst/file &&
301+ test_config -C dst rebase.autostash true &&
302+ git -C dst pull --rebase >actual 2>&1 &&
303+ grep -q "Successfully rebased and updated refs/heads/main." actual &&
304+ grep -q "Applied autostash." actual
305+ '
306+
255307test_done
0 commit comments