summaryrefslogtreecommitdiffstats
path: root/pre_commit/commands
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-19 07:00:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-19 07:00:38 +0000
commit00f5354c65dff6a40cda6b5a2c633f9e92eca1e1 (patch)
treef86bffc17d1b6349d92d3e235560d4850793461f /pre_commit/commands
parentReleasing debian version 2.18.1-1. (diff)
downloadpre-commit-00f5354c65dff6a40cda6b5a2c633f9e92eca1e1.tar.xz
pre-commit-00f5354c65dff6a40cda6b5a2c633f9e92eca1e1.zip
Merging upstream version 2.19.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/commands')
-rw-r--r--pre_commit/commands/hook_impl.py3
-rw-r--r--pre_commit/commands/validate_config.py16
-rw-r--r--pre_commit/commands/validate_manifest.py16
3 files changed, 34 insertions, 1 deletions
diff --git a/pre_commit/commands/hook_impl.py b/pre_commit/commands/hook_impl.py
index 18e5e9f..f315c04 100644
--- a/pre_commit/commands/hook_impl.py
+++ b/pre_commit/commands/hook_impl.py
@@ -114,7 +114,8 @@ def _pre_push_ns(
remote_url = args[1]
for line in stdin.decode().splitlines():
- local_branch, local_sha, remote_branch, remote_sha = line.split()
+ parts = line.rsplit(maxsplit=3)
+ local_branch, local_sha, remote_branch, remote_sha = parts
if local_sha == Z40:
continue
elif remote_sha != Z40 and _rev_exists(remote_sha):
diff --git a/pre_commit/commands/validate_config.py b/pre_commit/commands/validate_config.py
new file mode 100644
index 0000000..91bb017
--- /dev/null
+++ b/pre_commit/commands/validate_config.py
@@ -0,0 +1,16 @@
+from __future__ import annotations
+
+from pre_commit import clientlib
+
+
+def validate_config(filenames: list[str]) -> int:
+ ret = 0
+
+ for filename in filenames:
+ try:
+ clientlib.load_config(filename)
+ except clientlib.InvalidConfigError as e:
+ print(e)
+ ret = 1
+
+ return ret
diff --git a/pre_commit/commands/validate_manifest.py b/pre_commit/commands/validate_manifest.py
new file mode 100644
index 0000000..372a638
--- /dev/null
+++ b/pre_commit/commands/validate_manifest.py
@@ -0,0 +1,16 @@
+from __future__ import annotations
+
+from pre_commit import clientlib
+
+
+def validate_manifest(filenames: list[str]) -> int:
+ ret = 0
+
+ for filename in filenames:
+ try:
+ clientlib.load_manifest(filename)
+ except clientlib.InvalidManifestError as e:
+ print(e)
+ ret = 1
+
+ return ret