t / t3407-rebase-abort.shon commit rev-list: estimate number of bisection step left (9f199b1)
   1#!/bin/sh
   2
   3test_description='git rebase --abort tests'
   4
   5. ./test-lib.sh
   6
   7### Test that we handle space characters properly
   8work_dir="$(pwd)/test dir"
   9
  10test_expect_success setup '
  11        mkdir -p "$work_dir" &&
  12        cd "$work_dir" &&
  13        git init &&
  14        echo a > a &&
  15        git add a &&
  16        git commit -m a &&
  17        git branch to-rebase &&
  18
  19        echo b > a &&
  20        git commit -a -m b &&
  21        echo c > a &&
  22        git commit -a -m c &&
  23
  24        git checkout to-rebase &&
  25        echo d > a &&
  26        git commit -a -m "merge should fail on this" &&
  27        echo e > a &&
  28        git commit -a -m "merge should fail on this, too" &&
  29        git branch pre-rebase
  30'
  31
  32testrebase() {
  33        type=$1
  34        dotest=$2
  35
  36        test_expect_success "rebase$type --abort" '
  37                cd "$work_dir" &&
  38                # Clean up the state from the previous one
  39                git reset --hard pre-rebase &&
  40                test_must_fail git rebase$type master &&
  41                test -d "$dotest" &&
  42                git rebase --abort &&
  43                test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
  44                test ! -d "$dotest"
  45        '
  46
  47        test_expect_success "rebase$type --abort after --skip" '
  48                cd "$work_dir" &&
  49                # Clean up the state from the previous one
  50                git reset --hard pre-rebase &&
  51                test_must_fail git rebase$type master &&
  52                test -d "$dotest" &&
  53                test_must_fail git rebase --skip &&
  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                test ! -d "$dotest"
  58        '
  59
  60        test_expect_success "rebase$type --abort after --continue" '
  61                cd "$work_dir" &&
  62                # Clean up the state from the previous one
  63                git reset --hard pre-rebase &&
  64                test_must_fail git rebase$type master &&
  65                test -d "$dotest" &&
  66                echo c > a &&
  67                echo d >> a &&
  68                git add a &&
  69                test_must_fail git rebase --continue &&
  70                test $(git rev-parse HEAD) != $(git rev-parse master) &&
  71                git rebase --abort &&
  72                test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
  73                test ! -d "$dotest"
  74        '
  75}
  76
  77testrebase "" .git/rebase-apply
  78testrebase " --merge" .git/rebase-merge
  79
  80test_done