From f24958a7abc34ed8eadb0ee8fc5df6abe0e0b9a8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 18 May 2025 03:06:59 +0000 Subject: 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. --- Completion/Unix/Command/_git | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') 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] )) || -- cgit v1.2.3-70-g09d2