Skip to content
Permalink
Browse files

Remove git branch from version info

Remove git branch from version info. This information is not really
relevant (a branch can have any name; what is important is the commit
and/or tag). It also breaks building the release versions of binaries
(see
#1362)

Signed-off-by: Andy Goldstein <goldsteina@vmware.com>
  • Loading branch information
ncdc committed Nov 15, 2019
1 parent 14101ec commit f33b041e62fc489f4300ae23451558d46ac224cc
Showing with 1 addition and 6 deletions.
  1. +0 −3 cmd/versioninfo/versioninfo.go
  2. +1 −3 hack/version.sh
@@ -23,8 +23,6 @@ import (
)

var (
// GitBranch is the branch from which this binary was built
GitBranch string
// GitReleaseTag is the git tag from which this binary is released
GitReleaseTag string
// GitReleaseCommit is the commit corresponding to the GitReleaseTag
@@ -60,7 +58,6 @@ func printShortCleanVersionInfo() {
func printVerboseVersionInfo() {
fmt.Println("Version Info:")
fmt.Printf("GitReleaseTag: %q, Major: %q, Minor: %q, GitRelaseCommit: %q\n", GitReleaseTag, GitMajor, GitMinor, GitReleaseCommit)
fmt.Printf("Git Branch: %q\n", GitBranch)
fmt.Printf("Git commit: %q\n", GitCommit)
fmt.Printf("Git tree state: %q\n", GitTreeState)
}
@@ -67,7 +67,6 @@ version::get_version_vars() {
fi
fi

GIT_BRANCH=$(git branch | grep \* | cut -d ' ' -f2)
GIT_RELEASE_TAG=$(git describe --abbrev=0 --tags)
GIT_RELEASE_COMMIT=$(git rev-list -n 1 ${GIT_RELEASE_TAG} | head -c 14)
}
@@ -91,10 +90,9 @@ version::ldflags() {
add_ldflag "GitMajor" "${GIT_MAJOR}"
add_ldflag "GitMinor" "${GIT_MINOR}"
add_ldflag "GitVersion" "${GIT_VERSION}"
add_ldflag "GitBranch" "${GIT_BRANCH}"
add_ldflag "GitReleaseTag" "${GIT_RELEASE_TAG}"
add_ldflag "GitReleaseCommit" "${GIT_RELEASE_COMMIT}"

# The -ldflags parameter takes a single string, so join the output.
echo "${ldflags[*]-}"
}
}

0 comments on commit f33b041

Please sign in to comment.
You can’t perform that action at this time.