Skip to content

Commit 7149589

Browse files
committed
fixup! tests: replace mingw_test_cmp with a helper in C
The /dev/null trick does not even work... It makes `git diff --no-index` fail because it tries to access the XDG config as `\\.\GLOBALROOT\Device\Null/.config/git/config`, which is not even a valid path (and therefore the `access_error_is_ok()` check fails). Let's just use a known-missing path on Windows. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 502e856 commit 7149589

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-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

0 commit comments

Comments
 (0)