pungi/1184.patch

33 lines
1.2 KiB
Diff

From 9517df44c73576905041c0ad2d245d9286a574fe Mon Sep 17 00:00:00 2001
From: Lubomír Sedlář <lsedlar@redhat.com>
Date: May 07 2019 08:35:49 +0000
Subject: config: Fix getting default branch in SCM dict
If user configures branch as explicit None, we want to default to HEAD
(which is most likely refs/heads/master in git).
The original code was getting branch as None, which lead to wrong
resolver being used and the repo url being used as branch.
Fixes: https://pagure.io/pungi/issue/1181
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
---
diff --git a/pungi/checks.py b/pungi/checks.py
index 0df15dd..2f9478d 100644
--- a/pungi/checks.py
+++ b/pungi/checks.py
@@ -305,7 +305,8 @@ def _extend_with_default_and_alias(validator_class, offline=False):
and "repo" in instance[property]
):
instance[property]["branch"] = resolver(
- instance[property]["repo"], instance[property].get("branch", "HEAD")
+ instance[property]["repo"],
+ instance[property].get("branch") or "HEAD",
)
for error in _hook_errors(properties, instance, schema):