summaryrefslogtreecommitdiffstats
path: root/pre_commit
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-13 05:41:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-13 05:41:58 +0000
commite390ceede4a1b709bf25275d117e095f2ca0867f (patch)
treeff0ebfdddd406f4301c8d4c1146a2d2a5b6b0f1c /pre_commit
parentAdding upstream version 3.6.0. (diff)
downloadpre-commit-e390ceede4a1b709bf25275d117e095f2ca0867f.tar.xz
pre-commit-e390ceede4a1b709bf25275d117e095f2ca0867f.zip
Adding upstream version 3.6.1.upstream/3.6.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit')
-rw-r--r--pre_commit/main.py3
-rw-r--r--pre_commit/staged_files_only.py5
2 files changed, 8 insertions, 0 deletions
diff --git a/pre_commit/main.py b/pre_commit/main.py
index 18c978a..559c927 100644
--- a/pre_commit/main.py
+++ b/pre_commit/main.py
@@ -37,6 +37,9 @@ logger = logging.getLogger('pre_commit')
# pyvenv
os.environ.pop('__PYVENV_LAUNCHER__', None)
+# https://github.com/getsentry/snuba/pull/5388
+os.environ.pop('PYTHONEXECUTABLE', None)
+
COMMANDS_NO_GIT = {
'clean', 'gc', 'init-templatedir', 'sample-config',
'validate-config', 'validate-manifest',
diff --git a/pre_commit/staged_files_only.py b/pre_commit/staged_files_only.py
index fd28e1c..e1f81ba 100644
--- a/pre_commit/staged_files_only.py
+++ b/pre_commit/staged_files_only.py
@@ -59,6 +59,11 @@ def _unstaged_changes_cleared(patch_dir: str) -> Generator[None, None, None]:
# There weren't any staged files so we don't need to do anything
# special
yield
+ elif retcode == 1 and not diff_stdout.strip():
+ # due to behaviour (probably a bug?) in git with crlf endings and
+ # autocrlf set to either `true` or `input` sometimes git will refuse
+ # to show a crlf-only diff to us :(
+ yield
elif retcode == 1 and diff_stdout.strip():
patch_filename = f'patch{int(time.time())}-{os.getpid()}'
patch_filename = os.path.join(patch_dir, patch_filename)