Skip to content

fix: improve error message when git is not installed#5189

Closed
YuriNachos wants to merge 1 commit intojesseduffield:masterfrom
YuriNachos:fix/git-not-installed-error-5028
Closed

fix: improve error message when git is not installed#5189
YuriNachos wants to merge 1 commit intojesseduffield:masterfrom
YuriNachos:fix/git-not-installed-error-5028

Conversation

@YuriNachos
Copy link

Summary

  • When git is not installed at all, show a more helpful message instead of suggesting to upgrade git version
  • Adds detection for "executable file not found" / "command not found" errors
  • Shows "Git is not installed. Please install git to use lazygit." instead of "Git version must be at least 2.32.0. Please upgrade your git version."

Changes

  • Added GitNotInstalledError translation key in pkg/i18n/english.go
  • Added isGitNotInstalledError() helper function in pkg/app/app.go
  • Updated validateGitVersion() to check error type and show appropriate message

Motivation

Fixes #5028 - the error message was confusing when git wasn't installed at all

Test manual

# Temporarily rename git to simulate "not installed"
sudo mv /usr/bin/git /usr/bin/git.bak
lazygit
# Expected: "Git is not installed. Please install git to use lazygit."

# Restore git
sudo mv /usr/bin/git.bak /usr/bin/git

Checklist

  • Code compiles (go build)
  • Code formatted with gofumpt
  • Commit message follows conventional commits

When git is not installed at all, show a more helpful message
instead of suggesting to upgrade git version.

Fixes jesseduffield#5028
@stefanhaller
Copy link
Collaborator

As discussed here, this is not worth the added complexity. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

minor nit: message when git isn't installed yet isn't entirely correct.

2 participants