aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/msubprojects.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/msubprojects.py')
-rwxr-xr-xmesonbuild/msubprojects.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/msubprojects.py b/mesonbuild/msubprojects.py
index d515389..aa7a682 100755
--- a/mesonbuild/msubprojects.py
+++ b/mesonbuild/msubprojects.py
@@ -125,7 +125,9 @@ def update_git(wrap, repo_dir, options):
mlog.log(' -> No revision specified.')
return True
try:
- branch = git_output(['branch', '--show-current'], repo_dir).strip()
+ # Same as `git branch --show-current` but compatible with older git version
+ branch = git_output(['rev-parse', '--abbrev-ref', 'HEAD'], repo_dir).strip()
+ branch = branch if branch != 'HEAD' else ''
except GitException as e:
mlog.log(' -> Failed to determine current branch in', mlog.bold(repo_dir))
mlog.log(mlog.red(e.output))