Blob Blame History Raw
From d2c63c32306732695b7fe5f9dda3deecb7899f4f Mon Sep 17 00:00:00 2001
From: Jiri Kyjovsky <j1.kyjovsky@gmail.com>
Date: Sat, 15 Apr 2023 13:46:21 +0200
Subject: [PATCH 4/6] Allow empty commits when `uses_rpmautospec`

To avoid situations where the command `commit` by default does
commit when no change in repo is present.

Fixes: #677
JIRA: RHELCMP-11489
Merges: https://pagure.io/rpkg/pull-request/688

Signed-off-by: Jiri Kyjovsky <j1.kyjovsky@gmail.com>
---
 pyrpkg/__init__.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
index 0b9a869..187796e 100644
--- a/pyrpkg/__init__.py
+++ b/pyrpkg/__init__.py
@@ -1867,7 +1867,9 @@ class Commands(object):
 
         # construct the git command
         # We do this via subprocess because the git module is terrible.
-        cmd = ['git', 'commit', '--allow-empty']
+        cmd = ['git', 'commit']
+        if not self.is_retired() and self.uses_rpmautospec:
+            cmd.append('--allow-empty')
         if signoff:
             cmd.append('-s')
         if self.quiet:
-- 
2.39.2