t / t2102-update-index-symlinks.shon commit t5532: use write_script (ca386ee)
   1#!/bin/sh
   2#
   3# Copyright (c) 2007 Johannes Sixt
   4#
   5
   6test_description='git update-index on filesystem w/o symlinks test.
   7
   8This tests that git update-index keeps the symbolic link property
   9even if a plain file is in the working tree if core.symlinks is false.'
  10
  11. ./test-lib.sh
  12
  13test_expect_success \
  14'preparation' '
  15git config core.symlinks false &&
  16l=$(printf file | git hash-object -t blob -w --stdin) &&
  17echo "120000 $l symlink" | git update-index --index-info'
  18
  19test_expect_success \
  20'modify the symbolic link' '
  21printf new-file > symlink &&
  22git update-index symlink'
  23
  24test_expect_success \
  25'the index entry must still be a symbolic link' '
  26case "$(git ls-files --stage --cached symlink)" in
  27120000" "*symlink) echo pass;;
  28*) echo fail; git ls-files --stage --cached symlink; (exit 1);;
  29esac'
  30
  31test_done