Skip to content

Commit 8e0ca46

Browse files
author
Jonathan Dahan
committed
Fix git prompt if hacking in .git directory
1 parent a0b598f commit 8e0ca46

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
The format is based on [Keep a Changelog](http://keepachangelog.com/)
44
and this project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## Unreleased
7+
8+
### Fixed
9+
- geometry_git complaining when not in a work-tree
10+
611
## 2.0.5 - 2019-10-14
712

813
### Fixed

functions/geometry_git.zsh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ geometry_git_conflicts() {
8484
geometry_git() {
8585
(( $+commands[git] )) || return
8686

87-
command git rev-parse --git-dir > /dev/null 2>&1 || return
87+
local git_dir; git_dir=$(git rev-parse --git-dir 2>&1) || return
88+
pushd -q "${git_dir}/.."
8889

8990
$(command git rev-parse --is-bare-repository 2>/dev/null) \
9091
&& ansi ${GEOMETRY_GIT_COLOR_BARE:=blue} ${GEOMETRY_GIT_SYMBOL_BARE:=""} \
@@ -97,6 +98,6 @@ geometry_git() {
9798
$(geometry_git_status)
9899
)
99100

100-
local separator=${GEOMETRY_GIT_SEPARATOR:-" :: "}
101-
echo -n $(geometry_git_symbol) $(geometry_git_branch) ${(pj.$separator.)geometry_git_details}
101+
echo -n $(geometry_git_symbol) $(geometry_git_branch) ${(ej.${GEOMETRY_GIT_SEPARATOR:-" :: "}.)geometry_git_details}
102+
popd -q
102103
}

0 commit comments

Comments
 (0)