mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-06-16 20:58:05 +02:00
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.
This commit is contained in:
parent
2ccf41e577
commit
f24958a7ab
2 changed files with 7 additions and 2 deletions
|
@ -1,5 +1,9 @@
|
|||
2025-05-18 Daniel Shahaf <d.s@daniel.shahaf.name>
|
||||
|
||||
* unposted (mentioned on github #134):
|
||||
Completion/Unix/Command/_git: __git_worktrees: Match the order
|
||||
of $(git worktree list).
|
||||
|
||||
* github #134 (+ implement commit review suggestion):
|
||||
Completion/Unix/Command/_git: __git_worktrees: Use a library
|
||||
function
|
||||
|
|
|
@ -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] )) ||
|
||||
|
|
Loading…
Reference in a new issue