1#!/bin/sh
   2#
   3# Copyright (c) 2005 Junio C Hamano
   4#
   5test_description='git apply symlinks and partial files
   7'
   9. ./test-lib.sh
  11if ! test_have_prereq SYMLINKS
  13then
  14        say 'Symbolic links not supported, skipping tests.'
  15        test_done
  16fi
  17test_expect_success setup '
  19        ln -s path1/path2/path3/path4/path5 link1 &&
  21        git add link? &&
  22        git commit -m initial &&
  23        git branch side &&
  25        rm -f link? &&
  27        ln -s htap6 link1 &&
  29        git update-index link? &&
  30        git commit -m second &&
  31        git diff-tree -p HEAD^ HEAD >patch  &&
  33        git apply --stat --summary patch
  34'
  36test_expect_success 'apply symlink patch' '
  38        git checkout side &&
  40        git apply patch &&
  41        git diff-files -p >patched &&
  42        test_cmp patch patched
  43'
  45test_expect_success 'apply --index symlink patch' '
  47        git checkout -f side &&
  49        git apply --index patch &&
  50        git diff-index --cached -p HEAD >patched &&
  51        test_cmp patch patched
  52'
  54test_done