blob: 22f2c730ae8dbf995605e9134eeb2a5bc84065db [file] [log] [blame]
Johannes Sixt78a8d642007-03-02 22:11:30 +01001#!/bin/sh
2#
3# Copyright (c) 2007 Johannes Sixt
4#
5
Junio C Hamano5be60072007-07-02 22:52:14 -07006test_description='git update-index on filesystem w/o symlinks test.
Johannes Sixt78a8d642007-03-02 22:11:30 +01007
Junio C Hamano5be60072007-07-02 22:52:14 -07008This tests that git update-index keeps the symbolic link property
Johannes Sixt78a8d642007-03-02 22:11:30 +01009even 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' '
Junio C Hamano5be60072007-07-02 22:52:14 -070015git config core.symlinks false &&
Brian Gernhardt6ecfd912008-10-31 01:09:13 -040016l=$(printf file | git hash-object -t blob -w --stdin) &&
Junio C Hamano5be60072007-07-02 22:52:14 -070017echo "120000 $l symlink" | git update-index --index-info'
Johannes Sixt78a8d642007-03-02 22:11:30 +010018
19test_expect_success \
20'modify the symbolic link' '
Brian Gernhardt6ecfd912008-10-31 01:09:13 -040021printf new-file > symlink &&
Junio C Hamano5be60072007-07-02 22:52:14 -070022git update-index symlink'
Johannes Sixt78a8d642007-03-02 22:11:30 +010023
24test_expect_success \
25'the index entry must still be a symbolic link' '
Elia Pintofc12fa32015-12-22 16:05:53 +010026case "$(git ls-files --stage --cached symlink)" in
Ævar Arnfjörð Bjarmason335f8782010-06-24 17:44:49 +000027120000" "*symlink) echo pass;;
Junio C Hamano5be60072007-07-02 22:52:14 -070028*) echo fail; git ls-files --stage --cached symlink; (exit 1);;
Johannes Sixt78a8d642007-03-02 22:11:30 +010029esac'
30
31test_done