t / t3407-rebase-abort.shon commit Merge branch 'js/maint-daemon' (1a9b8bc)
   1#!/bin/sh
   2
   3test_description='git rebase --abort tests'
   4
   5. ./test-lib.sh
   6
   7test_expect_success setup '
   8        echo a > a &&
   9        git add a &&
  10        git commit -m a &&
  11        git branch to-rebase &&
  12
  13        echo b > a &&
  14        git commit -a -m b &&
  15        echo c > a &&
  16        git commit -a -m c &&
  17
  18        git checkout to-rebase &&
  19        echo d > a &&
  20        git commit -a -m "merge should fail on this" &&
  21        echo e > a &&
  22        git commit -a -m "merge should fail on this, too" &&
  23        git branch pre-rebase
  24'
  25
  26test_expect_success 'rebase --abort' '
  27        test_must_fail git rebase master &&
  28        git rebase --abort &&
  29        test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase)
  30'
  31
  32test_expect_success 'rebase --abort after --skip' '
  33        # Clean up the state from the previous one
  34        git reset --hard pre-rebase
  35        rm -rf .dotest
  36
  37        test_must_fail git rebase master &&
  38        test_must_fail git rebase --skip &&
  39        test $(git rev-parse HEAD) = $(git rev-parse master) &&
  40        git rebase --abort &&
  41        test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase)
  42'
  43
  44test_expect_success 'rebase --abort after --continue' '
  45        # Clean up the state from the previous one
  46        git reset --hard pre-rebase
  47        rm -rf .dotest
  48
  49        test_must_fail git rebase master &&
  50        echo c > a &&
  51        echo d >> a &&
  52        git add a &&
  53        test_must_fail git rebase --continue &&
  54        test $(git rev-parse HEAD) != $(git rev-parse master) &&
  55        git rebase --abort &&
  56        test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase)
  57'
  58
  59test_done