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 <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2018-10-02 21:55:11 +02:00
parent 502e856705
commit 7149589c5c

View File

@@ -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
};