testsuite: Add --strip-trailing-cr to diff call

On Windows, git defaults to maintaining line endings, which means it
changed \n to \r\n on all files it identifies as text. And that includes
our test output.

Luckily diff(1) has an option to undo that. And since we do not care
about line endings in those tests, we can just use it.
This commit is contained in:
Benjamin Otte
2024-11-04 20:53:46 +01:00
parent 0a6c4711bc
commit 6cd98bae3b
2 changed files with 2 additions and 2 deletions

View File

@@ -75,7 +75,7 @@ diff_with_file (const char *file1,
process = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_PIPE
| G_SUBPROCESS_FLAGS_STDOUT_PIPE,
error,
"diff", "-u", file1, "-", NULL);
"diff", "--strip-trailing-cr", "-u", file1, "-", NULL);
if (process == NULL)
return NULL;

View File

@@ -42,7 +42,7 @@ diff_with_file (const char *file1,
diff_cmd = g_find_program_in_path ("diff");
if (diff_cmd)
{
const char *command[] = { diff_cmd, "-u", file1, NULL, NULL };
const char *command[] = { diff_cmd, "--strip-trailing-cr", "-u", file1, NULL, NULL };
if (len < 0)
len = strlen (text);