Skip to content

Commit 596c611

Browse files
author
Jonathan Dahan
committed
Only use pushd/popd once in geometry_git
1 parent 8e0ca46 commit 596c611

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

functions/geometry_git.zsh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,9 @@ geometry_git_conflicts() {
6161

6262
[[ -z "$conflicts" ]] && return
6363

64-
pushd -q $(git rev-parse --show-toplevel)
65-
6664
_grep=${GEOMETRY_GIT_GREP:=${commands[rg]:=${commands[ag]:=${commands[grep]}}}}
6765
conflict_list=$($_grep -cH '^=======$' $conflicts)
6866

69-
popd -q
70-
7167
raw_file_count="${#${(@f)conflict_list}}"
7268
file_count=${raw_file_count##*( )}
7369

@@ -85,7 +81,7 @@ geometry_git() {
8581
(( $+commands[git] )) || return
8682

8783
local git_dir; git_dir=$(git rev-parse --git-dir 2>&1) || return
88-
pushd -q "${git_dir}/.."
84+
pushd -q "$git_dir"/..
8985

9086
$(command git rev-parse --is-bare-repository 2>/dev/null) \
9187
&& ansi ${GEOMETRY_GIT_COLOR_BARE:=blue} ${GEOMETRY_GIT_SYMBOL_BARE:=""} \
@@ -99,5 +95,5 @@ geometry_git() {
9995
)
10096

10197
echo -n $(geometry_git_symbol) $(geometry_git_branch) ${(ej.${GEOMETRY_GIT_SEPARATOR:-" :: "}.)geometry_git_details}
102-
popd -q
98+
popd -q 2>/dev/null
10399
}

0 commit comments

Comments
 (0)