t / t3418-rebase-continue.shon commit Merge branch 'ak/curl-imap-send-explicit-scheme' (6d6321a)
   1#!/bin/sh
   2
   3test_description='git rebase --continue tests'
   4
   5. ./test-lib.sh
   6
   7. "$TEST_DIRECTORY"/lib-rebase.sh
   8
   9set_fake_editor
  10
  11test_expect_success 'setup' '
  12        test_commit "commit-new-file-F1" F1 1 &&
  13        test_commit "commit-new-file-F2" F2 2 &&
  14
  15        git checkout -b topic HEAD^ &&
  16        test_commit "commit-new-file-F2-on-topic-branch" F2 22 &&
  17
  18        git checkout master
  19'
  20
  21test_expect_success 'interactive rebase --continue works with touched file' '
  22        rm -fr .git/rebase-* &&
  23        git reset --hard &&
  24        git checkout master &&
  25
  26        FAKE_LINES="edit 1" git rebase -i HEAD^ &&
  27        test-chmtime =-60 F1 &&
  28        git rebase --continue
  29'
  30
  31test_expect_success 'non-interactive rebase --continue works with touched file' '
  32        rm -fr .git/rebase-* &&
  33        git reset --hard &&
  34        git checkout master &&
  35
  36        test_must_fail git rebase --onto master master topic &&
  37        echo "Resolved" >F2 &&
  38        git add F2 &&
  39        test-chmtime =-60 F1 &&
  40        git rebase --continue
  41'
  42
  43test_expect_success 'non-interactive rebase --continue with rerere enabled' '
  44        test_config rerere.enabled true &&
  45        test_when_finished "test_might_fail git rebase --abort" &&
  46        git reset --hard commit-new-file-F2-on-topic-branch &&
  47        git checkout master &&
  48        rm -fr .git/rebase-* &&
  49
  50        test_must_fail git rebase --onto master master topic &&
  51        echo "Resolved" >F2 &&
  52        git add F2 &&
  53        cp F2 F2.expected &&
  54        git rebase --continue &&
  55
  56        git reset --hard commit-new-file-F2-on-topic-branch &&
  57        git checkout master &&
  58        test_must_fail git rebase --onto master master topic &&
  59        test_cmp F2.expected F2
  60'
  61
  62test_expect_success 'rebase --continue can not be used with other options' '
  63        test_must_fail git rebase -v --continue &&
  64        test_must_fail git rebase --continue -v
  65'
  66
  67test_expect_success 'rebase --continue remembers merge strategy and options' '
  68        rm -fr .git/rebase-* &&
  69        git reset --hard commit-new-file-F2-on-topic-branch &&
  70        test_commit "commit-new-file-F3-on-topic-branch" F3 32 &&
  71        test_when_finished "rm -fr test-bin funny.was.run" &&
  72        mkdir test-bin &&
  73        cat >test-bin/git-merge-funny <<-EOF &&
  74        #!$SHELL_PATH
  75        case "\$1" in --opt) ;; *) exit 2 ;; esac
  76        shift &&
  77        >funny.was.run &&
  78        exec git merge-recursive "\$@"
  79        EOF
  80        chmod +x test-bin/git-merge-funny &&
  81        (
  82                PATH=./test-bin:$PATH
  83                test_must_fail git rebase -s funny -Xopt master topic
  84        ) &&
  85        test -f funny.was.run &&
  86        rm funny.was.run &&
  87        echo "Resolved" >F2 &&
  88        git add F2 &&
  89        (
  90                PATH=./test-bin:$PATH
  91                git rebase --continue
  92        ) &&
  93        test -f funny.was.run
  94'
  95
  96test_expect_success 'rebase --continue remembers --rerere-autoupdate' '
  97        rm -fr .git/rebase-* &&
  98        git reset --hard commit-new-file-F3-on-topic-branch &&
  99        git checkout master &&
 100        test_commit "commit-new-file-F3" F3 3 &&
 101        git config rerere.enabled true &&
 102        test_must_fail git rebase -m master topic &&
 103        echo "Resolved" >F2 &&
 104        git add F2 &&
 105        test_must_fail git rebase --continue &&
 106        echo "Resolved" >F3 &&
 107        git add F3 &&
 108        git rebase --continue &&
 109        git reset --hard topic@{1} &&
 110        test_must_fail git rebase -m --rerere-autoupdate master &&
 111        test "$(cat F2)" = "Resolved" &&
 112        test_must_fail git rebase --continue &&
 113        test "$(cat F3)" = "Resolved" &&
 114        git rebase --continue
 115'
 116
 117test_done