@matheusbsbs / matheus-bagliano / commits / 05dcd69891
Fork 0

Test 'git add' for unmerged entries when core.symlinks=false.

In 20314271679e169f324c118c69c8d9e0399feec9 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 <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Sixt committed Jul 2, 2007 at 13:28 UTC 05dcd69891632101d347b2f8a6bc37a08878aa1a
1 file changed +17 -10
t/t3700-add.sh
+17 -10
@@ -110,30 +110,37 @@ test_expect_success 'check correct prefix detection' '
110 git add 1/2/a 1/3/b 1/2/c
111 '
112
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' '
114 for s in 1 2 3
115 do
116 + echo $s > stage$s
117 echo "100755 $(git hash-object -w stage$s) $s file"
118 + echo "120000 $(printf $s | git hash-object -w -t blob --stdin) $s symlink"
119 done | git update-index --index-info &&
120 git config core.filemode 0 &&
121 + git config core.symlinks 0 &&
122 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$"
127 '
128
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 &&
131 (
132 echo "100644 $(git hash-object -w stage1) 1 file"
133 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"
136 ) | git update-index --index-info &&
137 git config core.filemode 0 &&
138 + git config core.symlinks 0 &&
139 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$"
144 '
145
146 test_done