t / t3503-cherry-pick-root.shon commit Merge branch 'jn/mime-type-with-params' (2c6b5d8)
   1#!/bin/sh
   2
   3test_description='test cherry-picking (and reverting) a root commit'
   4
   5. ./test-lib.sh
   6
   7test_expect_success setup '
   8
   9        echo first > file1 &&
  10        git add file1 &&
  11        test_tick &&
  12        git commit -m "first" &&
  13
  14        git symbolic-ref HEAD refs/heads/second &&
  15        rm .git/index file1 &&
  16        echo second > file2 &&
  17        git add file2 &&
  18        test_tick &&
  19        git commit -m "second"
  20
  21'
  22
  23test_expect_success 'cherry-pick a root commit' '
  24
  25        git cherry-pick master &&
  26        echo first >expect &&
  27        test_cmp expect file1
  28
  29'
  30
  31test_expect_success 'revert a root commit' '
  32
  33        git revert master &&
  34        test_path_is_missing file1
  35
  36'
  37
  38test_expect_success 'cherry-pick a root commit with an external strategy' '
  39
  40        git cherry-pick --strategy=resolve master &&
  41        echo first >expect &&
  42        test_cmp expect file1
  43
  44'
  45
  46test_expect_success 'revert a root commit with an external strategy' '
  47
  48        git revert --strategy=resolve master &&
  49        test_path_is_missing file1
  50
  51'
  52
  53test_done