t / t4122-apply-symlink-inside.shon commit Merge branch 'jk/config-no-ungetc-eof' (de15bdb)
   1#!/bin/sh
   2
   3test_description='apply to deeper directory without getting fooled with symlink'
   4. ./test-lib.sh
   5
   6test_expect_success setup '
   7
   8        mkdir -p arch/i386/boot arch/x86_64 &&
   9        test_write_lines 1 2 3 4 5 >arch/i386/boot/Makefile &&
  10        test_ln_s_add ../i386/boot arch/x86_64/boot &&
  11        git add . &&
  12        test_tick &&
  13        git commit -m initial &&
  14        git branch test &&
  15
  16        rm arch/x86_64/boot &&
  17        mkdir arch/x86_64/boot &&
  18        test_write_lines 2 3 4 5 6 >arch/x86_64/boot/Makefile &&
  19        git add . &&
  20        test_tick &&
  21        git commit -a -m second &&
  22
  23        git format-patch --binary -1 --stdout >test.patch
  24
  25'
  26
  27test_expect_success apply '
  28
  29        git checkout test &&
  30        git diff --exit-code test &&
  31        git diff --exit-code --cached test &&
  32        git apply --index test.patch
  33
  34'
  35
  36test_expect_success 'check result' '
  37
  38        git diff --exit-code master &&
  39        git diff --exit-code --cached master &&
  40        test_tick &&
  41        git commit -m replay &&
  42        T1=$(git rev-parse "master^{tree}") &&
  43        T2=$(git rev-parse "HEAD^{tree}") &&
  44        test "z$T1" = "z$T2"
  45
  46'
  47
  48test_done