Skip to content

Commit

Permalink
make version detection ignore trailing chars
Browse files Browse the repository at this point in the history
Previously, version strings like this one (from macOS/Xcode git) were
not matched:
`git version 2.39.3 (Apple Git-146)`
  • Loading branch information
rrotter committed Oct 24, 2024
1 parent 0193ade commit 19e3e5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git-prompt.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ setopt PROMPT_SUBST

# Use --show-stash for git versions newer than 2.35.0
_zsh_git_prompt_git_version=$(command git version)
if [[ "${_zsh_git_prompt_git_version:12}" == 2.<35->.<-> ]]; then
if [[ "${_zsh_git_prompt_git_version:12}" == 2.<35->.<->* ]]; then
_zsh_git_prompt_git_cmd() {
GIT_OPTIONAL_LOCKS=0 command git status --show-stash --branch --porcelain=v2 2>&1 \
|| echo "fatal: git command failed"
Expand Down

0 comments on commit 19e3e5e

Please sign in to comment.