Skip to content

Commit 9988587

Browse files
author
Jonathan Dahan
committed
Show git info in submodule, fixes #285, thanks @JokeNeverSoke
1 parent 98c0a5e commit 9988587

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1313

1414
### Fixed
1515
- geometry_git complaining when not in a work-tree
16+
- geometry_git works in submodules now, (thanks @JokeNeverSoke!)
1617

1718
### Removed
1819
- GEOMETRY_GIT_SEPARATOR hidden feature, was the only function that didnt work like the others.

functions/geometry_git

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,20 @@ geometry_git_conflicts() {
8080
geometry_git() {
8181
(( $+commands[git] )) || return
8282

83-
local git_dir; git_dir=$(git rev-parse --git-dir 2>&1) || return
84-
pushd -q "$git_dir"/..
83+
git rev-parse --absolute-git-dir 2>&1 >/dev/null || return
8584

8685
$(command git rev-parse --is-bare-repository 2>/dev/null) \
8786
&& ansi ${GEOMETRY_GIT_COLOR_BARE:=blue} ${GEOMETRY_GIT_SYMBOL_BARE:="⬢"} \
8887
&& return
8988

9089
local git_info && git_info=(
91-
$(geometry_git_symbol)
92-
$(geometry_git_branch)
93-
$(geometry_git_conflicts)
94-
$(geometry_git_time)
95-
$(geometry_git_stashes)
96-
$(geometry_git_status)
90+
geometry_git_symbol \
91+
geometry_git_branch \
92+
geometry_git_conflicts \
93+
geometry_git_time \
94+
geometry_git_stashes \
95+
geometry_git_status
9796
)
9897

99-
echo -n ${(ej.${GEOMETRY_SEPARATOR:- }.)git_info}
100-
popd -q 2>/dev/null
98+
geometry::wrap $PWD $git_info
10199
}

0 commit comments

Comments
 (0)