@@ -472,6 +472,66 @@ test_expect_success 'pull --no-autostash & merge.autostash unset' '
472
472
test_pull_autostash_fail --no-autostash --no-rebase
473
473
'
474
474
475
+ test_expect_success ' pull succeeds with dirty working directory and pull.autostash=true' '
476
+ test_config pull.autostash true &&
477
+ test_pull_autostash 1 --rebase &&
478
+ test_pull_autostash 2 --no-rebase &&
479
+ test_pull_autostash 1 --autostash --rebase &&
480
+ test_pull_autostash 2 --autostash --no-rebase
481
+ '
482
+
483
+ test_expect_success ' pull fails with dirty working directory and pull.autostash=false' '
484
+ test_config pull.autostash false &&
485
+ test_pull_autostash_fail --rebase &&
486
+ test_pull_autostash_fail --no-rebase &&
487
+ test_pull_autostash_fail --no-autostash --rebase &&
488
+ test_pull_autostash_fail --no-autostash --no-rebase
489
+ '
490
+
491
+ test_expect_success ' pull --autostash overrides pull.autostash=false' '
492
+ test_config pull.autostash false &&
493
+ test_pull_autostash 1 --autostash --rebase &&
494
+ test_pull_autostash 2 --autostash --no-rebase
495
+ '
496
+
497
+ test_expect_success ' pull --no-autostash overrides pull.autostash=true' '
498
+ test_config pull.autostash true &&
499
+ test_pull_autostash_fail --no-autostash --rebase &&
500
+ test_pull_autostash_fail --no-autostash --no-rebase
501
+ '
502
+
503
+ test_expect_success ' pull.autostash=true overrides rebase.autostash' '
504
+ test_config pull.autostash true &&
505
+ test_config rebase.autostash true &&
506
+ test_pull_autostash 1 --rebase &&
507
+ test_config rebase.autostash false &&
508
+ test_pull_autostash 1 --rebase
509
+ '
510
+
511
+ test_expect_success ' pull.autostash=false overrides rebase.autostash' '
512
+ test_config pull.autostash false &&
513
+ test_config rebase.autostash true &&
514
+ test_pull_autostash_fail --rebase &&
515
+ test_config rebase.autostash false &&
516
+ test_pull_autostash_fail --rebase
517
+ '
518
+
519
+ test_expect_success ' pull.autostash=true overrides merge.autostash' '
520
+ test_config pull.autostash true &&
521
+ test_config merge.autostash true &&
522
+ test_pull_autostash 2 --no-rebase &&
523
+ test_config merge.autostash false &&
524
+ test_pull_autostash 2 --no-rebase
525
+ '
526
+
527
+ test_expect_success ' pull.autostash=false overrides merge.autostash' '
528
+ test_config pull.autostash false &&
529
+ test_config merge.autostash true &&
530
+ test_pull_autostash_fail --no-rebase &&
531
+ test_config merge.autostash false &&
532
+ test_pull_autostash_fail --no-rebase
533
+ '
534
+
475
535
test_expect_success ' pull.rebase' '
476
536
git reset --hard before-rebase &&
477
537
test_config pull.rebase true &&
0 commit comments