summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Command/_git5
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 30b8e237e..61512a7f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
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] )) ||