summaryrefslogtreecommitdiff
path: root/0006-Do-not-generate-pre-push-hook-script-in-some-cases.patch
diff options
context:
space:
mode:
Diffstat (limited to '0006-Do-not-generate-pre-push-hook-script-in-some-cases.patch')
-rw-r--r--0006-Do-not-generate-pre-push-hook-script-in-some-cases.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/0006-Do-not-generate-pre-push-hook-script-in-some-cases.patch b/0006-Do-not-generate-pre-push-hook-script-in-some-cases.patch
new file mode 100644
index 0000000..3369959
--- /dev/null
+++ b/0006-Do-not-generate-pre-push-hook-script-in-some-cases.patch
@@ -0,0 +1,37 @@
+From 30f189736137a50da4b740acf775ff6675a15a70 Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Wed, 8 Mar 2023 16:39:16 +0100
+Subject: [PATCH] Do not generate pre-push hook script in some cases
+
+Some rpkg users don't use fedpkg or similar tool for cloning
+and therefore there is no tool to execute the pre-push-check
+function. Do not generate the hook script in this case.
+
+Fixes: #665
+JIRA: RHELCMP-11392
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ pyrpkg/__init__.py | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index acdad22..776cb21 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -1795,6 +1795,13 @@ class Commands(object):
+ for possible user mistakes.
+ """
+ tool_name = os.path.basename(sys.argv[0]) # rhpkg|fedpkg|...
++ if not tool_name:
++ # empty argv - this functionality is not executed from x-pkg tool
++ # and therefore there isn't a program that can run pre-push-check.
++ # Example: the COPR team executes 'clone' by their own script.
++ self.log.debug('Pre-push hook script was NOT added - missing '
++ 'the packaging tool like fedpkg, rhpkg, ...')
++ return
+ hook_content = textwrap.dedent("""
+ #!/bin/bash
+
+--
+2.39.2
+