summaryrefslogtreecommitdiffstats
path: root/Completion/Unix
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2025-05-18 03:06:59 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2025-05-18 03:06:59 +0000
commitf24958a7abc34ed8eadb0ee8fc5df6abe0e0b9a8 (patch)
tree2b02cfe631f46b11037e8ab1ff7d28b836aa2d1a /Completion/Unix
parentgithub #134 (+ implement commit review suggestion): __git_worktrees: Use a li... (diff)
downloadzsh-f24958a7abc34ed8eadb0ee8fc5df6abe0e0b9a8.tar
zsh-f24958a7abc34ed8eadb0ee8fc5df6abe0e0b9a8.tar.gz
zsh-f24958a7abc34ed8eadb0ee8fc5df6abe0e0b9a8.tar.bz2
zsh-f24958a7abc34ed8eadb0ee8fc5df6abe0e0b9a8.tar.lz
zsh-f24958a7abc34ed8eadb0ee8fc5df6abe0e0b9a8.tar.xz
zsh-f24958a7abc34ed8eadb0ee8fc5df6abe0e0b9a8.tar.zst
zsh-f24958a7abc34ed8eadb0ee8fc5df6abe0e0b9a8.zip
unposted (mentioned on github #134): __git_worktrees: Match the order of $(git worktree list).
The output of __git_worktrees() now matches the output of `git worktree list` exactly, modulo the 'list-separator' style.
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Command/_git5
1 files changed, 3 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 95bd3096d..7c7b0d764 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -8520,7 +8520,7 @@ __git_worktrees () {
hash=${${${"${(f)i}"[2]}#HEAD }[1,9]}
branch=${${"${(f)i}"[3]}#branch refs/heads/}
- # Simulate the non-porcelain output
+ # Simulate the non-porcelain output of `git worktree list`
if [[ $branch == detached ]]; then
# TODO: show a ref that points at $hash here, like vcs_info does?
branch="(detached HEAD)"
@@ -8531,7 +8531,8 @@ __git_worktrees () {
descriptions+=( "${directories[-1]//(#b)([\\:])/\\${match[1]}}":"$hash $branch" )
done
- _describe -t directories 'working tree' descriptions -S ' ' -f -M 'r:|/=* r:|=*'
+ # Use -V so the order matches the output of `git worktree list`.
+ _describe -V -t directories 'working tree' descriptions -S ' ' -f -M 'r:|/=* r:|=*'
}
(( $+functions[__git_difftools] )) ||