t / t4131-apply-fake-ancestor.shon commit Merge branch 'sw/git-p4-unshelve-branched-files' (e7ef93b)
   1#!/bin/sh
   2#
   3# Copyright (c) 2009 Stephen Boyd
   4#
   5
   6test_description='git apply --build-fake-ancestor handling.'
   7
   8. ./test-lib.sh
   9
  10test_expect_success 'setup' '
  11        test_commit 1 &&
  12        test_commit 2 &&
  13        mkdir sub &&
  14        test_commit 3 sub/3.t &&
  15        test_commit 4
  16'
  17
  18test_expect_success 'apply --build-fake-ancestor' '
  19        git checkout 2 &&
  20        echo "A" > 1.t &&
  21        git diff > 1.patch &&
  22        git reset --hard &&
  23        git checkout 1 &&
  24        git apply --build-fake-ancestor 1.ancestor 1.patch
  25'
  26
  27test_expect_success 'apply --build-fake-ancestor in a subdirectory' '
  28        git checkout 3 &&
  29        echo "C" > sub/3.t &&
  30        git diff > 3.patch &&
  31        git reset --hard &&
  32        git checkout 4 &&
  33        (
  34                cd sub &&
  35                git apply --build-fake-ancestor 3.ancestor ../3.patch &&
  36                test -f 3.ancestor
  37        ) &&
  38        git apply --build-fake-ancestor 3.ancestor 3.patch &&
  39        test_cmp sub/3.ancestor 3.ancestor
  40'
  41
  42test_done