Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…opier to v0.4.4 (#28)
  • Loading branch information
salt-extensions-renovatebot[bot] authored Sep 25, 2024
1 parent 92b001b commit 047628c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Autogenerated. Do not edit this by hand, use `copier update`.
---
_commit: 0.4.2
_commit: 0.4.4
_src_path: https://github.com/salt-extensions/salt-extension-copier
author: jeanluc
author_email: [email protected]
Expand Down
9 changes: 8 additions & 1 deletion tools/helpers/pre_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ def run_pre_commit(venv, retries=2):
Usually, a maximum of two runs is necessary (if a hook reformats the
output of another later one again).
"""
new_files = set()

def _run_pre_commit_loop(retries_left):
untracked_files = set(map(str, list_untracked()))
nonlocal new_files
new_files = new_files.union(untracked_files)
# Ensure pre-commit runs on all paths.
# We don't want to git add . because this removes merge conflicts
git("add", "--intent-to-add", *map(str, list_untracked()))
git("add", "--intent-to-add", *untracked_files)
with local.venv(venv):
try:
local["python"]("-m", "pre_commit", "run", "--all-files")
Expand All @@ -97,4 +101,7 @@ def _run_pre_commit_loop(retries_left):
prompt.warn(f"Pre-commit is failing. {msg}")
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)
return False

0 comments on commit 047628c

Please sign in to comment.