diff --git a/mesonbuild/msubprojects.py b/mesonbuild/msubprojects.py index b058f5bb7..c9081ba5b 100755 --- a/mesonbuild/msubprojects.py +++ b/mesonbuild/msubprojects.py @@ -261,9 +261,14 @@ class Runner: self.git_output(['fetch', '--refmap', heads_refmap, '--refmap', tags_refmap, 'origin', revision]) except GitException as e: self.log(' -> Could not fetch revision', mlog.bold(revision), 'in', mlog.bold(self.repo_dir)) - self.log(mlog.red(e.output)) - self.log(mlog.red(str(e))) - return False + if quiet_git(['rev-parse', revision + '^{commit}'], self.repo_dir)[0]: + self.log(mlog.yellow('WARNING:'), 'Proceeding with locally available copy') + # Trick git into setting FETCH_HEAD from the local revision. + quiet_git(['fetch', '.', revision], self.repo_dir) + else: + self.log(mlog.red(e.output)) + self.log(mlog.red(str(e))) + return False if branch == '': # We are currently in detached mode