Skip to content

Commit 5dc9bbd

Browse files
ci: fix requirements diff check crash [backport 2.1] (#7823)
Backport 0dba5d5 from #7815 to 2.1. This change fixes a silent failure of `scripts/check-diff` that can result in outdated riot lockfiles being committed to trunk. The failure is caused by the use of the `-I` option to `git diff` on versions of git too old to support that option, such as the version installed in the testrunner container used in CI. ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment. - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) - [x] If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. - [x] This PR doesn't touch any of that. Co-authored-by: Emmett Butler <[email protected]>
1 parent 66292da commit 5dc9bbd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/check-diff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
directory=${1:-"."}
44
message=${2:-"Files were changed or added."}
5-
changed_files="$(git diff -I '^#' -- ${directory})"
5+
changed_files="$(git diff -G'^[^#]' -- ${directory})"
66
new_files="$(git ls-files -o --exclude-standard -- ${directory})"
77

8-
if [[ "$(git diff -I '^#' --exit-code -- ${directory})" || -n $new_files ]]
8+
if [[ "$(git diff -G'^[^#]' --exit-code -- ${directory})" || -n $new_files ]]
99
then
1010
echo "${changed_files}"
1111
echo "${new_files}"

0 commit comments

Comments
 (0)