Thread (52 messages) 52 messages, 1 author, 2022-08-30
STALE1390d

[PATCH 07/51] zsh: simplify realpath dirname idiom

From: Felipe Contreras <hidden>
Date: 2022-08-30 09:32:14
Subsystem: the rest · Maintainer: Linus Torvalds

There's a much simpler way in zsh.

It's a shame that ${0:A:h} doesn't work probably due to a bug in zsh.

Signed-off-by: Felipe Contreras <redacted>
---
 contrib/completion/git-completion.zsh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 1a405ba0a2..18ad897568 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -33,7 +33,7 @@ if [ -z "$script" ]; then
 		bash_completion='/usr/share/bash-completion/completions/'
 
 	locations=(
-		"$(dirname $(realpath ${funcsourcetrace[1]%:*}))"/git-completion.bash
+		"${${funcsourcetrace[1]%:*}:A:h}"/git-completion.bash
 		"$HOME/.local/share/bash-completion/completions/git"
 		'/usr/local/share/bash-completion/completions/git'
 		"$bash_completion/git"
-- 
2.37.2.351.g9bf691b78c.dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help