diff --git a/t/helper/test-cmp.c b/t/helper/test-cmp.c index 98dd0791520fe0..1c646a54bf609b 100644 --- a/t/helper/test-cmp.c +++ b/t/helper/test-cmp.c @@ -5,6 +5,12 @@ #include "parse-options.h" #include "run-command.h" +#ifdef WIN32 +#define NO_SUCH_DIR "\\\\.\\GLOBALROOT\\invalid" +#else +#define NO_SUCH_DIR "/dev/null" +#endif + static int run_diff(const char *path1, const char *path2) { const char *argv[] = { @@ -12,8 +18,8 @@ static int run_diff(const char *path1, const char *path2) }; const char *env[] = { "GIT_PAGER=cat", - "GIT_DIR=/dev/null", - "HOME=/dev/null", + "GIT_DIR=" NO_SUCH_DIR, + "HOME=" NO_SUCH_DIR, NULL }; diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 7c48ed2aba2843..7f19368fc10b43 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -307,10 +307,20 @@ test_expect_success 'init prefers command line to GIT_DIR' ' test_path_is_missing otherdir/refs ' +downcase_on_case_insensitive_fs () { + test false = "$(git config --get core.filemode)" || return 0 + for f + do + tr A-Z a-z <"$f" >"$f".downcased && + mv -f "$f".downcased "$f" || return 1 + done +} + test_expect_success 'init with separate gitdir' ' rm -rf newdir && git init --separate-git-dir realgitdir newdir && echo "gitdir: $(pwd)/realgitdir" >expected && + downcase_on_case_insensitive_fs expected newdir/.git && test_cmp expected newdir/.git && test_path_is_dir realgitdir/refs ' @@ -365,6 +375,7 @@ test_expect_success 're-init to update git link' ' git init --separate-git-dir ../surrealgitdir ) && echo "gitdir: $(pwd)/surrealgitdir" >expected && + downcase_on_case_insensitive_fs expected newdir/.git && test_cmp expected newdir/.git && test_path_is_dir surrealgitdir/refs && test_path_is_missing realgitdir/refs @@ -378,6 +389,7 @@ test_expect_success 're-init to move gitdir' ' git init --separate-git-dir ../realgitdir ) && echo "gitdir: $(pwd)/realgitdir" >expected && + downcase_on_case_insensitive_fs expected newdir/.git && test_cmp expected newdir/.git && test_path_is_dir realgitdir/refs '