From 98d445a0708e56a511fb91c6189dea97b0a57d43 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 7 Aug 2020 10:06:33 -0400 Subject: msubprojects: Support git subprojects with no wrap file User could have cloned manually a subproject. --- mesonbuild/msubprojects.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mesonbuild/msubprojects.py') diff --git a/mesonbuild/msubprojects.py b/mesonbuild/msubprojects.py index 4575181..f1cc515 100755 --- a/mesonbuild/msubprojects.py +++ b/mesonbuild/msubprojects.py @@ -53,6 +53,10 @@ def update_git(wrap, repo_dir, options): mlog.log(' -> Not used.') return revision = wrap.get('revision') + if not revision: + # It could be a detached git submodule for example. + mlog.log(' -> No revision specified.') + return branch = git_output(['branch', '--show-current'], repo_dir).strip() if branch == '': try: @@ -145,6 +149,9 @@ def checkout(wrap, repo_dir, options): if wrap.type != 'git' or not os.path.isdir(repo_dir): return branch_name = options.branch_name if options.branch_name else wrap.get('revision') + if not branch_name: + # It could be a detached git submodule for example. + return cmd = ['checkout', branch_name, '--'] if options.b: cmd.insert(1, '-b') -- cgit v1.1