Skip to content

Commit 263ced1

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
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 c77fb87 commit 263ced1

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
@@ -308,10 +308,20 @@ test_expect_success 'init prefers command line to GIT_DIR' '
308308
test_path_is_missing otherdir/refs
309309
'
310310

311+
downcase_on_case_insensitive_fs () {
312+
test false = "$(git config --get core.filemode)" || return 0
313+
for f
314+
do
315+
tr A-Z a-z <"$f" >"$f".downcased &&
316+
mv -f "$f".downcased "$f" || return 1
317+
done
318+
}
319+
311320
test_expect_success 'init with separate gitdir' '
312321
rm -rf newdir &&
313322
git init --separate-git-dir realgitdir newdir &&
314323
echo "gitdir: $(pwd)/realgitdir" >expected &&
324+
downcase_on_case_insensitive_fs expected newdir/.git &&
315325
test_cmp expected newdir/.git &&
316326
test_path_is_dir realgitdir/refs
317327
'
@@ -366,6 +376,7 @@ test_expect_success 're-init to update git link' '
366376
git init --separate-git-dir ../surrealgitdir
367377
) &&
368378
echo "gitdir: $(pwd)/surrealgitdir" >expected &&
379+
downcase_on_case_insensitive_fs expected newdir/.git &&
369380
test_cmp expected newdir/.git &&
370381
test_path_is_dir surrealgitdir/refs &&
371382
test_path_is_missing realgitdir/refs
@@ -379,6 +390,7 @@ test_expect_success 're-init to move gitdir' '
379390
git init --separate-git-dir ../realgitdir
380391
) &&
381392
echo "gitdir: $(pwd)/realgitdir" >expected &&
393+
downcase_on_case_insensitive_fs expected newdir/.git &&
382394
test_cmp expected newdir/.git &&
383395
test_path_is_dir realgitdir/refs
384396
'

0 commit comments

Comments
 (0)