Skip to content

Commit

Permalink
Don't crash in pre-commit automation when no new files were added
Browse files Browse the repository at this point in the history
  • Loading branch information
lkubb committed Sep 25, 2024
1 parent f7b63cb commit 895ce41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions project/tools/helpers/pre_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def _run_pre_commit_loop(retries_left):
for i, failing_hook in enumerate(failing):
prompt.warn(f"✗ Failing hook ({i + 1}): {failing_hook}", failing[failing_hook])
finally:
# Undo git add --intent-to-add to allow RenovateBot to detect new files correctly
git("restore", "--staged", *new_files)
if new_files:
# Undo git add --intent-to-add to allow RenovateBot to detect new files correctly
git("restore", "--staged", *new_files)
return False

0 comments on commit 895ce41

Please sign in to comment.