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>
This commit is contained in:
Lubomír Sedlář 2019-05-07 08:39:17 +02:00
parent a9b9ec97fb
commit 9517df44c7
1 changed files with 2 additions and 1 deletions

View File

@ -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):