Skip to content

Commit

Permalink
fixup! tests: replace mingw_test_cmp with a helper in C
Browse files Browse the repository at this point in the history
  • Loading branch information
dscho committed Jun 22, 2018
1 parent 63f4efb commit cd1a74f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions t/helper/test-cmp.c
Expand Up @@ -11,7 +11,10 @@ static int run_diff(const char *path1, const char *path2)
"diff", "--no-index", NULL, NULL, NULL "diff", "--no-index", NULL, NULL, NULL
}; };
const char *env[] = { const char *env[] = {
"GIT_PAGER=cat", NULL "GIT_PAGER=cat",
"GIT_DIR=/dev/null",
"HOME=/dev/null",
NULL
}; };


argv[2] = path1; argv[2] = path1;
Expand Down Expand Up @@ -48,7 +51,10 @@ int cmd__cmp(int argc, const char **argv)
if (r1 == EOF) if (r1 == EOF)
return 0; return 0;
cmp_failed: cmp_failed:
return !!run_diff(argv[1], argv[2]); if (!run_diff(argv[1], argv[2]))
die("Huh? 'diff --no-index %s %s' succeeded",
argv[1], argv[2]);
return 1;
} }
if (r1 == EOF || strbuf_cmp(&b0, &b1)) { if (r1 == EOF || strbuf_cmp(&b0, &b1)) {
fclose(f0); fclose(f0);
Expand Down

2 comments on commit cd1a74f

@hechaozong
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good

@dscho
Copy link
Member Author

@dscho dscho commented on cd1a74f Jul 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hechaozong Care to explain yourself?

Please sign in to comment.