Skip to content

Commit d4f95fc

Browse files
authored
Merge pull request #1859 from dscho/funny-cased-cwd
Fix t0001 when the current working directory differs in case from the canonical form
2 parents 6cbf663 + a00c26c commit d4f95fc

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

t/helper/test-cmp.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,21 @@
55
#include "parse-options.h"
66
#include "run-command.h"
77

8+
#ifdef WIN32
9+
#define NO_SUCH_DIR "\\\\.\\GLOBALROOT\\invalid"
10+
#else
11+
#define NO_SUCH_DIR "/dev/null"
12+
#endif
13+
814
static int run_diff(const char *path1, const char *path2)
915
{
1016
const char *argv[] = {
1117
"diff", "--no-index", NULL, NULL, NULL
1218
};
1319
const char *env[] = {
1420
"GIT_PAGER=cat",
15-
"GIT_DIR=/dev/null",
16-
"HOME=/dev/null",
21+
"GIT_DIR=" NO_SUCH_DIR,
22+
"HOME=" NO_SUCH_DIR,
1723
NULL
1824
};
1925

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)