t / t4252-am-options.shon commit filter-branch: Fix fatal error on bare repositories (9273b56)
   1#!/bin/sh
   2
   3test_description='git am not losing options'
   4. ./test-lib.sh
   5
   6tm="$TEST_DIRECTORY/t4252"
   7
   8test_expect_success setup '
   9        cp "$tm/file-1-0" file-1 &&
  10        cp "$tm/file-2-0" file-2 &&
  11        git add file-1 file-2 &&
  12        test_tick &&
  13        git commit -m initial &&
  14        git tag initial
  15'
  16
  17test_expect_success 'interrupted am --whitespace=fix' '
  18        rm -rf .git/rebase-apply &&
  19        git reset --hard initial &&
  20        test_must_fail git am --whitespace=fix "$tm"/am-test-1-? &&
  21        git am --skip &&
  22        grep 3 file-1 &&
  23        grep "^Six$" file-2
  24'
  25
  26test_expect_success 'interrupted am -C1' '
  27        rm -rf .git/rebase-apply &&
  28        git reset --hard initial &&
  29        test_must_fail git am -C1 "$tm"/am-test-2-? &&
  30        git am --skip &&
  31        grep 3 file-1 &&
  32        grep "^Three$" file-2
  33'
  34
  35test_expect_success 'interrupted am -p2' '
  36        rm -rf .git/rebase-apply &&
  37        git reset --hard initial &&
  38        test_must_fail git am -p2 "$tm"/am-test-3-? &&
  39        git am --skip &&
  40        grep 3 file-1 &&
  41        grep "^Three$" file-2
  42'
  43
  44test_expect_success 'interrupted am -C1 -p2' '
  45        rm -rf .git/rebase-apply &&
  46        git reset --hard initial &&
  47        test_must_fail git am -p2 -C1 "$tm"/am-test-4-? &&
  48        git am --skip &&
  49        grep 3 file-1 &&
  50        grep "^Three$" file-2
  51'
  52
  53test_done