summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-11-14 10:00:58 +1100
committerGitHub <noreply@github.com>2022-11-14 10:00:58 +1100
commitf67824b349fdbdcd1779e260f80bd26a446a4702 (patch)
tree036f5707ded3be995cf3aa8d980e4f2f9755c86d /pkg
parenta905a28e41d7b0d4c72c78b9b65f45f511c49fd1 (diff)
parent526d02de1c9e9d2729c3ed33070c32d95721bbeb (diff)
Merge pull request #2265 from nitinmewar/gitVersion
Diffstat (limited to 'pkg')
-rw-r--r--pkg/app/entry_point.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkg/app/entry_point.go b/pkg/app/entry_point.go
index b355ebcca..9519abb65 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,10 @@ 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
+}