t / t4128-apply-root.shon commit Teach "git apply" to prepend a prefix with "--root=<root>" (c4730f3)
   1#!/bin/sh
   2
   3test_description='apply same filename'
   4
   5. ./test-lib.sh
   6
   7test_expect_success 'setup' '
   8
   9        mkdir -p some/sub/dir &&
  10        echo Hello > some/sub/dir/file &&
  11        git add some/sub/dir/file
  12
  13'
  14
  15cat > patch << EOF
  16diff a/bla/blub/dir/file b/bla/blub/dir/file
  17--- a/bla/blub/dir/file
  18+++ b/bla/blub/dir/file
  19@@ -1,1 +1,1 @@
  20-Hello
  21+Bello
  22EOF
  23
  24test_expect_success 'apply --root -p --index' '
  25
  26        git apply --root=some/sub -p3 --index patch &&
  27        test Bello = $(git show :some/sub/dir/file) &&
  28        test Bello = $(cat some/sub/dir/file)
  29
  30'
  31
  32test_done