Skip to content

Commit 05dcd69

Browse files
Johannes Sixtgitster
authored andcommitted
Test 'git add' for unmerged entries when core.symlinks=false.
In 2031427 git add was fixed if unmerged entries are in the index and core.filemode=false. core.symlinks=false is a similar case, which touches the same code path. Here is a test that makes sure that the symlink property in the index is preserved, too. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 098e711 commit 05dcd69

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

t/t3700-add.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,30 +110,37 @@ test_expect_success 'check correct prefix detection' '
110110
git add 1/2/a 1/3/b 1/2/c
111111
'
112112

113-
test_expect_success 'git add and filemode=0 with unmerged entries' '
114-
echo 1 > stage1 &&
115-
echo 2 > stage2 &&
116-
echo 3 > stage3 &&
113+
test_expect_success 'git add with filemode=0, symlinks=0, and unmerged entries' '
117114
for s in 1 2 3
118115
do
116+
echo $s > stage$s
119117
echo "100755 $(git hash-object -w stage$s) $s file"
118+
echo "120000 $(printf $s | git hash-object -w -t blob --stdin) $s symlink"
120119
done | git update-index --index-info &&
121120
git config core.filemode 0 &&
121+
git config core.symlinks 0 &&
122122
echo new > file &&
123-
git add file &&
124-
git ls-files --stage | grep "^100755 .* 0 file$"
123+
echo new > symlink &&
124+
git add file symlink &&
125+
git ls-files --stage | grep "^100755 .* 0 file$" &&
126+
git ls-files --stage | grep "^120000 .* 0 symlink$"
125127
'
126128

127-
test_expect_success 'git add and filemode=0 prefers stage 2 over stage 1' '
128-
git rm --cached -f file &&
129+
test_expect_success 'git add with filemode=0, symlinks=0 prefers stage 2 over stage 1' '
130+
git rm --cached -f file symlink &&
129131
(
130132
echo "100644 $(git hash-object -w stage1) 1 file"
131133
echo "100755 $(git hash-object -w stage2) 2 file"
134+
echo "100644 $(printf $s | git hash-object -w -t blob --stdin) 1 symlink"
135+
echo "120000 $(printf $s | git hash-object -w -t blob --stdin) 2 symlink"
132136
) | git update-index --index-info &&
133137
git config core.filemode 0 &&
138+
git config core.symlinks 0 &&
134139
echo new > file &&
135-
git add file &&
136-
git ls-files --stage | grep "^100755 .* 0 file$"
140+
echo new > symlink &&
141+
git add file symlink &&
142+
git ls-files --stage | grep "^100755 .* 0 file$" &&
143+
git ls-files --stage | grep "^120000 .* 0 symlink$"
137144
'
138145

139146
test_done

0 commit comments

Comments
 (0)