Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pkg/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,22 @@ func NewApp(config config.AppConfigurer, test integrationTypes.IntegrationTest,
return app, nil
}

const minGitVersionStr = "2.32.0"

func minGitVersionErrorMessage(tr *i18n.TranslationSet) string {
return fmt.Sprintf(tr.MinGitVersionError, minGitVersionStr)
}

func (app *App) validateGitVersion() (*git_commands.GitVersion, error) {
version, err := git_commands.GetGitVersion(app.OSCommand)
// if we get an error anywhere here we'll show the same status
minVersionError := errors.New(app.Tr.MinGitVersionError)
minVersionError := errors.New(minGitVersionErrorMessage(app.Tr))
if err != nil {
return nil, minVersionError
}

if version.IsOlderThan(2, 32, 0) {
minRequiredVersion, _ := git_commands.ParseGitVersion(minGitVersionStr)
if version.IsOlderThanVersion(minRequiredVersion) {
return nil, minVersionError
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/app/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type errorMapping struct {
func knownError(tr *i18n.TranslationSet, err error) (string, bool) {
errorMessage := err.Error()

knownErrorMessages := []string{tr.MinGitVersionError}
knownErrorMessages := []string{minGitVersionErrorMessage(tr)}

if lo.Contains(knownErrorMessages, errorMessage) {
return errorMessage, true
Expand Down
2 changes: 1 addition & 1 deletion pkg/i18n/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,7 @@ func EnglishTranslationSet() *TranslationSet {
CreateNewBranchFromCommit: "Create new branch off of commit",
BuildingPatch: "Building patch",
ViewCommits: "View commits",
MinGitVersionError: "Git version must be at least 2.32 (i.e. from 2021 onwards). Please upgrade your git version. Alternatively raise an issue at https://github.com/jesseduffield/lazygit/issues for lazygit to be more backwards compatible.",
MinGitVersionError: "Git version must be at least %s. Please upgrade your git version.",
RunningCustomCommandStatus: "Running custom command",
SubmoduleStashAndReset: "Stash uncommitted submodule changes and update",
AndResetSubmodules: "And reset submodules",
Expand Down