]> git.ipfire.org Git - thirdparty/git.git/blame - t/t2102-update-index-symlinks.sh
The third batch
[thirdparty/git.git] / t / t2102-update-index-symlinks.sh
CommitLineData
78a8d641
JS
1#!/bin/sh
2#
3# Copyright (c) 2007 Johannes Sixt
4#
5
5be60078 6test_description='git update-index on filesystem w/o symlinks test.
78a8d641 7
5be60078 8This tests that git update-index keeps the symbolic link property
78a8d641
JS
9even if a plain file is in the working tree if core.symlinks is false.'
10
977e458c 11TEST_PASSES_SANITIZE_LEAK=true
78a8d641
JS
12. ./test-lib.sh
13
14test_expect_success \
15'preparation' '
5be60078 16git config core.symlinks false &&
6ecfd91d 17l=$(printf file | git hash-object -t blob -w --stdin) &&
5be60078 18echo "120000 $l symlink" | git update-index --index-info'
78a8d641
JS
19
20test_expect_success \
21'modify the symbolic link' '
6ecfd91d 22printf new-file > symlink &&
5be60078 23git update-index symlink'
78a8d641
JS
24
25test_expect_success \
26'the index entry must still be a symbolic link' '
fc12fa35 27case "$(git ls-files --stage --cached symlink)" in
335f8787 28120000" "*symlink) echo pass;;
77b1d9f3 29*) echo fail; git ls-files --stage --cached symlink; false;;
78a8d641
JS
30esac'
31
32test_done