From 1f1e1e4ec212394a0492e9667d2700cb74403481 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Tue, 15 Nov 2022 10:31:43 -0500 Subject: [PATCH] build-release-tarball: Override merge-base for full official releases. --- tools/build-release-tarball | 11 ++++------- tools/cache-zulip-git-version | 12 ++++++++---- tools/release | 7 +++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tools/build-release-tarball b/tools/build-release-tarball index df177b6e7b..85a3e7670e 100755 --- a/tools/build-release-tarball +++ b/tools/build-release-tarball @@ -61,19 +61,16 @@ cd "$BASEDIR" git checkout-index -f -a --prefix "$OUTPUT_DIR/$prefix/" # Add the Git version information file -./tools/cache-zulip-git-version if [[ "$version" =~ ^[0-9]+\.[0-9]+$ ]]; then + # We override the merge-base, to avoid having to push the commits before building the tarball. + OVERRIDE_MERGE_BASE="$version" ./tools/cache-zulip-git-version generated_version=$(head -n1 zulip-git-version) - base_version=$(head -n2 zulip-git-version | tail -n1) if [ "$generated_version" != "$version" ]; then echo "Version $version looks like a release version, but is not tagged yet! Got $generated_version" exit 1 fi - if [ "$base_version" != "$version" ]; then - remote="$(git config zulip.zulipRemote)" || remote=upstream - echo "Commit for $version have not been pushed to remote $remote -- 'branched from' reports $base_version, not $version" - exit 1 - fi +else + ./tools/cache-zulip-git-version fi mv zulip-git-version "$OUTPUT_DIR/$prefix/" diff --git a/tools/cache-zulip-git-version b/tools/cache-zulip-git-version index 87d282372a..7e0a41740a 100755 --- a/tools/cache-zulip-git-version +++ b/tools/cache-zulip-git-version @@ -5,9 +5,13 @@ cd "$(dirname "$0")/.." remote="$(git config zulip.zulipRemote)" || remote=upstream { git describe --always --tags --match='[0-9]*' - branches="$(git for-each-ref --format='%(objectname)' "refs/remotes/$remote/main" "refs/remotes/$remote/*.x" "refs/remotes/$remote/*-branch")" - mapfile -t branches <<<"$branches" - if merge_base="$(git merge-base -- HEAD "${branches[@]}")"; then - git describe --always --tags --match='[0-9]*' -- "$merge_base" + if [ -z "${OVERRIDE_MERGE_BASE+x}" ]; then + branches="$(git for-each-ref --format='%(objectname)' "refs/remotes/$remote/main" "refs/remotes/$remote/*.x" "refs/remotes/$remote/*-branch")" + mapfile -t branches <<<"$branches" + if merge_base="$(git merge-base -- HEAD "${branches[@]}")"; then + git describe --always --tags --match='[0-9]*' -- "$merge_base" + fi + else + echo "$OVERRIDE_MERGE_BASE" fi } >zulip-git-version diff --git a/tools/release b/tools/release index 9189973c12..9166939c07 100755 --- a/tools/release +++ b/tools/release @@ -102,10 +102,6 @@ sleep 15 git tag "$version" -# Commits need to be pushed to the remote so that "branched from" is correct -remote="$(git config zulip.zulipRemote)" || remote=upstream -git push "$remote" "$branch:$branch" - OUTPUT_DIR=$(mktemp -d) export OUTPUT_DIR @@ -119,6 +115,9 @@ fi ./tools/upload-release "$TARBALL" +# Push the commits +remote="$(git config zulip.zulipRemote)" || remote=upstream +git push "$remote" "$branch:$branch" git push "$remote" "$version" # Upload to Github