diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-09-19 11:50:04 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-09-19 23:34:33 -0400 |
commit | 99112d6c7977c8248d370165ed464a8af2d88e91 (patch) | |
tree | cd4d20c76cdb71ccb9e3f13c025d162ca9589c73 /mesonbuild/msubprojects.py | |
parent | 4568482316f63c48559b97c9a4771740ed61eca6 (diff) | |
download | meson-99112d6c7977c8248d370165ed464a8af2d88e91.zip meson-99112d6c7977c8248d370165ed464a8af2d88e91.tar.gz meson-99112d6c7977c8248d370165ed464a8af2d88e91.tar.bz2 |
msubprojects: when revision is an available commit, do not fetch updates
It's not even worth bothering to contact the network because it can
never be anything other than what we have already.
Diffstat (limited to 'mesonbuild/msubprojects.py')
-rwxr-xr-x | mesonbuild/msubprojects.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/msubprojects.py b/mesonbuild/msubprojects.py index c9081ba..dfcff01 100755 --- a/mesonbuild/msubprojects.py +++ b/mesonbuild/msubprojects.py @@ -248,7 +248,13 @@ class Runner: self.log(mlog.red(e.output)) self.log(mlog.red(str(e))) return False - if True: + if self.wrap_resolver.is_git_full_commit_id(revision) and \ + quiet_git(['rev-parse', '--verify', revision + '^{commit}'], self.repo_dir)[0]: + # The revision we need is both a commit and available. So we do not + # need to fetch it because it cannot be updated. Instead, trick + # git into setting FETCH_HEAD just in case, from the local commit. + self.git_output(['fetch', '.', revision]) + else: try: # Fetch only the revision we need, this avoids fetching useless branches. # revision can be either a branch, tag or commit id. In all cases we want |