diff mbox series

[layerindex-web] layerindex: allow empty Actual branch

Message ID 20240131000935.283663-1-tim.orling@konsulko.com
State New
Headers show
Series [layerindex-web] layerindex: allow empty Actual branch | expand

Commit Message

Tim Orling Jan. 31, 2024, 12:09 a.m. UTC
Exposing the actual_branch field of LayerBranch in the UI
was intending to _enable_ setting a non-default value, but
the check was accidentally left in a state that _requires_
a value.

[YOCTO #15376]

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 layerindex/forms.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/layerindex/forms.py b/layerindex/forms.py
index 3b764f1..a9e7703 100644
--- a/layerindex/forms.py
+++ b/layerindex/forms.py
@@ -187,10 +187,11 @@  class EditLayerForm(StyledModelForm):
     def clean_actual_branch(self):
         import subprocess
         actual_branch = self.cleaned_data['actual_branch'].strip()
-        process = subprocess.Popen(["git", "check-ref-format", "--branch", actual_branch])
-        exit_status = process.wait()
-        if exit_status != 0:
-            raise forms.ValidationError("Actual branch should be a valid git branch short name")
+        if len(actual_branch) > 0:
+            process = subprocess.Popen(["git", "check-ref-format", "--branch", actual_branch])
+            exit_status = process.wait()
+            if exit_status != 0:
+                raise forms.ValidationError("Actual branch should be a valid git branch short name")
         return actual_branch