From 188890fc49b8a8a2ccabf68307d1cfc7e2ef0a31 Mon Sep 17 00:00:00 2001 From: nitin mewar Date: Sat, 12 Nov 2022 16:00:24 +0530 Subject: [PATCH 1/2] added gitVersion to version flag Signed-off-by: nitin mewar --- pkg/app/entry_point.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/app/entry_point.go b/pkg/app/entry_point.go index b355ebcca..28fd7d491 100644 --- a/pkg/app/entry_point.go +++ b/pkg/app/entry_point.go @@ -17,6 +17,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/env" integrationTypes "github.com/jesseduffield/lazygit/pkg/integration/types" "github.com/jesseduffield/lazygit/pkg/logs" + "github.com/jesseduffield/lazygit/pkg/secureexec" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/samber/lo" "gopkg.in/yaml.v3" @@ -83,7 +84,8 @@ func Start(buildInfo *BuildInfo, integrationTest integrationTypes.IntegrationTes } if cliArgs.PrintVersionInfo { - fmt.Printf("commit=%s, build date=%s, build source=%s, version=%s, os=%s, arch=%s\n", buildInfo.Commit, buildInfo.Date, buildInfo.BuildSource, buildInfo.Version, runtime.GOOS, runtime.GOARCH) + gitVersion := getGitVersionInfo() + fmt.Printf("commit=%s, build date=%s, build source=%s, version=%s, os=%s, arch=%s, git version=%s\n", buildInfo.Commit, buildInfo.Date, buildInfo.BuildSource, buildInfo.Version, runtime.GOOS, runtime.GOARCH, gitVersion) os.Exit(0) } @@ -268,3 +270,9 @@ func mergeBuildInfo(buildInfo *BuildInfo) { buildInfo.Date = time.Value } } +func getGitVersionInfo() string { + cmd := secureexec.Command("git", "--version") + stdout, _ := cmd.Output() + gitVersion := strings.Trim(strings.TrimPrefix(string(stdout), "git version "), " \r\n") + return gitVersion +} From 526d02de1c9e9d2729c3ed33070c32d95721bbeb Mon Sep 17 00:00:00 2001 From: nitin mewar Date: Sun, 13 Nov 2022 19:27:12 +0530 Subject: [PATCH 2/2] added gitVersion for version flag Signed-off-by: nitin mewar --- pkg/app/entry_point.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/app/entry_point.go b/pkg/app/entry_point.go index 28fd7d491..9519abb65 100644 --- a/pkg/app/entry_point.go +++ b/pkg/app/entry_point.go @@ -270,6 +270,7 @@ func mergeBuildInfo(buildInfo *BuildInfo) { buildInfo.Date = time.Value } } + func getGitVersionInfo() string { cmd := secureexec.Command("git", "--version") stdout, _ := cmd.Output()