summaryrefslogtreecommitdiffstats
path: root/pre_commit/commands
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-01-30 06:41:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-01-30 06:41:13 +0000
commit110f2a64b57a8781ccbe1040021d5baaec761e01 (patch)
treed9bf0d538aff0d47e28ea2da949c00955bf920d4 /pre_commit/commands
parentAdding upstream version 2.9.3. (diff)
downloadpre-commit-110f2a64b57a8781ccbe1040021d5baaec761e01.tar.xz
pre-commit-110f2a64b57a8781ccbe1040021d5baaec761e01.zip
Adding upstream version 2.10.0.upstream/2.10.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.py7
-rw-r--r--pre_commit/commands/run.py3
2 files changed, 8 insertions, 2 deletions
diff --git a/pre_commit/commands/hook_impl.py b/pre_commit/commands/hook_impl.py
index d0e226f..25c5fdf 100644
--- a/pre_commit/commands/hook_impl.py
+++ b/pre_commit/commands/hook_impl.py
@@ -69,6 +69,7 @@ def _ns(
color: bool,
*,
all_files: bool = False,
+ remote_branch: Optional[str] = None,
from_ref: Optional[str] = None,
to_ref: Optional[str] = None,
remote_name: Optional[str] = None,
@@ -79,6 +80,7 @@ def _ns(
return argparse.Namespace(
color=color,
hook_stage=hook_type.replace('pre-', ''),
+ remote_branch=remote_branch,
from_ref=from_ref,
to_ref=to_ref,
remote_name=remote_name,
@@ -106,13 +108,14 @@ def _pre_push_ns(
remote_url = args[1]
for line in stdin.decode().splitlines():
- _, local_sha, _, remote_sha = line.split()
+ _, local_sha, remote_branch, remote_sha = line.split()
if local_sha == Z40:
continue
elif remote_sha != Z40 and _rev_exists(remote_sha):
return _ns(
'pre-push', color,
from_ref=remote_sha, to_ref=local_sha,
+ remote_branch=remote_branch,
remote_name=remote_name, remote_url=remote_url,
)
else:
@@ -133,6 +136,7 @@ def _pre_push_ns(
'pre-push', color,
all_files=True,
remote_name=remote_name, remote_url=remote_url,
+ remote_branch=remote_branch,
)
else:
rev_cmd = ('git', 'rev-parse', f'{first_ancestor}^')
@@ -141,6 +145,7 @@ def _pre_push_ns(
'pre-push', color,
from_ref=source, to_ref=local_sha,
remote_name=remote_name, remote_url=remote_url,
+ remote_branch=remote_branch,
)
# nothing to push
diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py
index 1e8fad2..891488d 100644
--- a/pre_commit/commands/run.py
+++ b/pre_commit/commands/run.py
@@ -371,7 +371,8 @@ def run(
environ['PRE_COMMIT_FROM_REF'] = args.from_ref
environ['PRE_COMMIT_TO_REF'] = args.to_ref
- if args.remote_name and args.remote_url:
+ if args.remote_name and args.remote_url and args.remote_branch:
+ environ['PRE_COMMIT_REMOTE_BRANCH'] = args.remote_branch
environ['PRE_COMMIT_REMOTE_NAME'] = args.remote_name
environ['PRE_COMMIT_REMOTE_URL'] = args.remote_url