Skip to content

Commit 1dd56d0

Browse files
committed
t0001: fix on case-insensitive filesystems
On a case-insensitive filesystem, such as HFS+ or NTFS, it is possible that the idea Bash has of the current directory differs in case from what Git thinks it is. That's totally okay, though, and we should not expect otherwise. Reported by Jameson Miller. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 8104ec9 commit 1dd56d0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

t/t0001-init.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,20 @@ test_expect_success 'init prefers command line to GIT_DIR' '
307307
test_path_is_missing otherdir/refs
308308
'
309309

310+
downcase_on_case_insensitive_fs () {
311+
test false = "$(git config --get core.filemode)" || return 0
312+
for f
313+
do
314+
tr A-Z a-z <"$f" >"$f".downcased &&
315+
mv -f "$f".downcased "$f" || return 1
316+
done
317+
}
318+
310319
test_expect_success 'init with separate gitdir' '
311320
rm -rf newdir &&
312321
git init --separate-git-dir realgitdir newdir &&
313322
echo "gitdir: $(pwd)/realgitdir" >expected &&
323+
downcase_on_case_insensitive_fs expected newdir/.git &&
314324
test_cmp expected newdir/.git &&
315325
test_path_is_dir realgitdir/refs
316326
'
@@ -365,6 +375,7 @@ test_expect_success 're-init to update git link' '
365375
git init --separate-git-dir ../surrealgitdir
366376
) &&
367377
echo "gitdir: $(pwd)/surrealgitdir" >expected &&
378+
downcase_on_case_insensitive_fs expected newdir/.git &&
368379
test_cmp expected newdir/.git &&
369380
test_path_is_dir surrealgitdir/refs &&
370381
test_path_is_missing realgitdir/refs
@@ -378,6 +389,7 @@ test_expect_success 're-init to move gitdir' '
378389
git init --separate-git-dir ../realgitdir
379390
) &&
380391
echo "gitdir: $(pwd)/realgitdir" >expected &&
392+
downcase_on_case_insensitive_fs expected newdir/.git &&
381393
test_cmp expected newdir/.git &&
382394
test_path_is_dir realgitdir/refs
383395
'

0 commit comments

Comments
 (0)