fix: Raise an error if no refspec is provided

Only local repositories may be configured without refspec.
Raise an error if a repository url is given but refspec is not.

Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Tobias Schaffner
2022-02-21 09:25:37 +01:00
committed by Jan Kiszka
parent d7af4dc678
commit 1c53b817b5
3 changed files with 26 additions and 1 deletions

View File

@@ -111,6 +111,10 @@ class Repo:
typ = repo_config.get('type', 'git')
refspec = repo_config.get('refspec',
repo_defaults.get('refspec', None))
if refspec is None and url is not None:
logging.error('No refspec specified for repository "%s". This is '
'only allowed for local repositories.', name)
sys.exit(1)
path = repo_config.get('path', None)
disable_operations = False