From 24dc9dc50eb0fc38ac274bd9cf3e1cce87dc82d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Sun, 20 Oct 2024 17:46:52 +0200 Subject: [PATCH] fix git diff commands --- .github/workflows/bin/refresh | 4 ++-- .github/workflows/checks.yml | 2 +- tests/Unit/ChangelogTest.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/bin/refresh b/.github/workflows/bin/refresh index bb9759946..8271d502a 100755 --- a/.github/workflows/bin/refresh +++ b/.github/workflows/bin/refresh @@ -65,7 +65,7 @@ if ($return !== 0) { /** * Check if something changed */ -$output = call('git diff --numstat src/'); +$output = call('git diff --numstat -- src/'); if (empty($output)) { console_log('Nothing changed.'); @@ -98,7 +98,7 @@ foreach ($output as $line) { continue; } - $fileChanges = call('git diff --no-color -U0 '.escapeshellarg($file)); + $fileChanges = call('git diff --no-color -U0 -- '.escapeshellarg($file)); foreach ($fileChanges as $lineChange) { if (!$lineChange) { continue; diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 31f1cf6bb..0b00b12f5 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -97,7 +97,7 @@ jobs: echo "###################################################" echo "" - git diff src + git diff -- src exit 1 fi diff --git a/tests/Unit/ChangelogTest.php b/tests/Unit/ChangelogTest.php index 61285205d..1f31c4e50 100644 --- a/tests/Unit/ChangelogTest.php +++ b/tests/Unit/ChangelogTest.php @@ -198,8 +198,8 @@ static function ($branch) { }); $output = array_merge( - self::call('git diff --numstat HEAD src/'), - self::call('git diff --numstat ' . $branches[0] . '...HEAD src/') + self::call('git diff --numstat HEAD -- src/'), + self::call('git diff --numstat ' . $branches[0] . '...HEAD -- src/') ); $changedServices = []; @@ -250,7 +250,7 @@ static function ($branch) { $isCommentOnly = true; foreach ($changedFiles as $changedFile) { - $changedLines = self::call('git diff --no-color -U0 ' . escapeshellarg($changesService['base'] . $changedFile)); + $changedLines = self::call('git diff --no-color -U0 -- ' . escapeshellarg($changesService['base'] . $changedFile)); foreach ($changedLines as $changedLine) { if (!$changedLine) { continue;