6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-12 01:34:04 +00:00

Remove the awkward "built at" section from --version

This commit is contained in:
Grzegorz Dlugoszewski
2025-08-23 22:36:03 +02:00
parent e1f73dc99d
commit f0365087ce

View File

@@ -49,17 +49,20 @@ var AllowedOut = []string{OutDump, OutFlat, OutTree}
var ( var (
version string version string
commit string commit string
date string
) )
// Version returns a string with version metadata: version number, git sha and build date. // Version returns a string with version metadata: version number and git commit.
// It returns "development" if version variables are not set during the build. // It returns "git-get development" if version variables are not set during the build.
func Version() string { func Version() string {
if version == "" { if version == "" {
return "development" return "git-get development"
} }
return fmt.Sprintf("%s - revision %s built at %s", version, commit[:6], date) if commit != "" {
return fmt.Sprintf("git-get %s (%s)", version, commit[:7])
}
return fmt.Sprintf("git-get %s", version)
} }
// Gitconfig represents gitconfig file // Gitconfig represents gitconfig file