Skip to content

Commit

Permalink
test: Fix non-dirty files being reported as dirty
Browse files Browse the repository at this point in the history
Fixes non-dirty files being reported as dirty.

Since the `is_dirty` variable was initialized as 0 outside the for loop,
after a dirty file was found, all the subsequent files were also
reported as dirty. Initializing it in the every iteration fixes this
issue.

Signed-off-by: Takahiro Itazuri <[email protected]>
  • Loading branch information
zulinx86 authored and pb8o committed Jun 22, 2023
1 parent ea94cc7 commit d4b1974
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/deny_dirty_cargo_locks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
- name: "Check no Cargo.lock files are dirty"
run: |
exit_code=0
is_dirty=0
# This breaks for paths with whitespaces in them, but we have an integration test
# that prevents those from existing in this repository.
for f in $(find . -name 'Cargo.lock' -not -path "./build/*"); do
is_dirty=0
(
cd "$(dirname "$f")"
cargo --locked metadata --format-version 1 >/dev/null 2>&1
Expand Down

0 comments on commit d4b1974

Please sign in to comment.