function buildFromParts(packageVersion, gitInfo) {
  let { tag, branch, sha } = gitInfo;
  let shortSha = sha.slice(0, 8);
  if (tag) {
    let tagVersion = parseTagVersion(tag);
    return {
      tag,
      branch: null,
      sha,
      shortSha,
      channel: 'tag',
      packageVersion,
      tagVersion,
      version: tagVersion,
      isBuildForTag: true,
    };
  } else {
    let channel =
      branch === 'main'
        ? process.env.BUILD_TYPE === 'alpha'
          ? 'alpha'
          : 'canary'
        : branch && escapeSemVerIdentifier(branch);
    let version = buildVersion(packageVersion, shortSha, channel);
    return {
      tag: null,
      branch,
      sha,
      shortSha,
      channel,
      packageVersion,
      tagVersion: null,
      version,
      isBuildForTag: false,
    };
  }
}
Build info object from parts.
@param {string} packageVersion
@param {GitInfo} gitInfo
@returns {BuildInfo}