Skip to content

Commit

Permalink
Merge pull request #2323 from pre-commit/move-try-slightly
Browse files Browse the repository at this point in the history
move patch discarding inside `try` for staged_files_only
  • Loading branch information
asottile committed Apr 2, 2022
2 parents 7602abc + a138c85 commit 3aa2ce8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pre_commit/staged_files_only.py
Expand Up @@ -66,9 +66,9 @@ def _unstaged_changes_cleared(patch_dir: str) -> Generator[None, None, None]:

# prevent recursive post-checkout hooks (#1418)
no_checkout_env = dict(os.environ, _PRE_COMMIT_SKIP_POST_CHECKOUT='1')
cmd_output_b(*_CHECKOUT_CMD, env=no_checkout_env)

try:
cmd_output_b(*_CHECKOUT_CMD, env=no_checkout_env)
yield
finally:
# Try to apply the patch we saved
Expand Down

0 comments on commit 3aa2ce8

Please sign in to comment.