diff options
author | camelid <camelidcamel@gmail.com> | 2020-05-30 17:30:22 -0700 |
---|---|---|
committer | camelid <camelidcamel@gmail.com> | 2020-05-30 17:30:22 -0700 |
commit | 02d69a0fdadd38116486bd464461de83b6df830d (patch) | |
tree | a2d7046cc674ce1235855d4a2ff654d8fe79f9aa /python/servo/command_base.py | |
parent | 5dae012db80deb2ebb1c5589bbddf3e35f730842 (diff) | |
download | servo-02d69a0fdadd38116486bd464461de83b6df830d.tar.gz servo-02d69a0fdadd38116486bd464461de83b6df830d.zip |
Get the real commit hash, not the bundle hash
It's extracted from the commit message of the bundle.
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r-- | python/servo/command_base.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index e3942ef66e0..9172a398e1f 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -734,9 +734,16 @@ install them, let us know by filing a bug!") git_info = [] if os.path.isdir('.git') and is_build: - git_sha = subprocess.check_output([ - 'git', 'rev-parse', '--short', 'HEAD' + # Get the subject of the bundle commit + git_bundle_subject = subprocess.check_output([ + 'git', 'show', '-s', '--format=%s', 'HEAD' ]).strip() + # Get the SHA-1 from the bundle subject: "Shallow version of commit {sha1}" + git_sha = git_bundle_subject.split(' ')[-1] + # Verify that it's a valid commit + # NOTE: this will pass even if `git_sha` is 'master' or another branch or ref + subprocess.check_call('git', 'cat-file', 'commit', git_sha) + git_is_dirty = bool(subprocess.check_output([ 'git', 'status', '--porcelain' ]).strip()) |