This enables to add more arguments later on by constructing the git command
to be executed.

Doing that with the current design of that function would end up having
to handle a power of two of the possible conditions:

With one condition (subject_prefix), we have 2 commands to generate.

With two conditions, we would have 4 commands to generate:
- subject_prefix False, New condition False
- subject_prefix False, New condition True
- subject_prefix True, New condition False
- subject_prefix True, New condition True

Signed-off-by: Denis 'GNUtoo' Carikli <[email protected]>
---
 patches/replicant_prepare_patch.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/patches/replicant_prepare_patch.py 
b/patches/replicant_prepare_patch.py
index 079b4a2..5fd02c3 100755
--- a/patches/replicant_prepare_patch.py
+++ b/patches/replicant_prepare_patch.py
@@ -139,13 +139,13 @@ def get_subject_prefix(config, revision):
 
 def generate_patches(config, git_revision, nr_patches, patches_revision):
     subject_prefix = get_subject_prefix(config, patches_revision)
-    if subject_prefix == None:
-        patches = git('format-patch',
-                      git_revision, '-{}'.format(nr_patches)).split(os.linesep)
-    else:
-        patches = git('format-patch', git_revision, '-{}'.format(nr_patches),
-                     '--subject-prefix={}'.format(
-                         subject_prefix)).split(os.linesep)
+
+    git_arguments = ['format-patch', git_revision, '-{}'.format(nr_patches)]
+
+    if subject_prefix != None:
+        git_arguments.append('--subject-prefix={}'.format(subject_prefix))
+
+    patches = git(*git_arguments).split(os.linesep)
 
     patches.remove('')
 
-- 
2.28.0

_______________________________________________
Replicant mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/replicant

Reply via email to