bootstrap.bash: only fetch git revision if we need it
Updates #22912
Fixes #23610
Change-Id: Id1c91fc3f040412d5931dba40e430685793f8eea
Reviewed-on: https://go-review.googlesource.com/90715
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/src/bootstrap.bash b/src/bootstrap.bash
index 7b4f574..32b736a 100755
--- a/src/bootstrap.bash
+++ b/src/bootstrap.bash
@@ -77,7 +77,11 @@
rm -rf "pkg/${gohostos}_${gohostarch}" "pkg/tool/${gohostos}_${gohostarch}"
fi
-GITREV=$(git rev-parse --short HEAD)
+if [ "$BOOTSTRAP_FORMAT" = "mintgz" ]; then
+ # Fetch git revision before rm -rf .git.
+ GITREV=$(git rev-parse --short HEAD)
+fi
+
rm -rf pkg/bootstrap pkg/obj .git
# Support for building minimal tar.gz for the builders.