Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the real commit hash for `./servo --version`, not the bundle hash #26720

Merged
merged 4 commits into from Jun 6, 2020
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Get the real commit hash, not the bundle hash

It's extracted from the commit message of the bundle.
  • Loading branch information
camelid committed May 31, 2020
commit 02d69a0fdadd38116486bd464461de83b6df830d
@@ -734,9 +734,16 @@ def build_env(self, hosts_file_path=None, target=None, is_build=False, test_unit

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())
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.