Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] completion: git: fix __git_commit_objects/__git_recent_commits



Daniel Hahler wrote on Sun, May 17, 2015 at 19:37:53 +0200:
> From: Daniel Hahler <git@xxxxxxxxxx>
> 
> $pipestatus for `: foo` appears to be 0 always.
> Explicitly declare `$commits` as associative array, and assign it
> normally.

The change from sequential to associative array breaks __git_recent_commits.
I assume you should revert the declaration change but keep the
initialization change.

Incidentally, _describe's documentation says colons should be escaped,
so I think we also need something like this:

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 918f6be..a281597 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5672,7 +5672,7 @@ __git_recent_commits () {
   for i j k in "$commits[@]" ; do
     # Note: the after-the-colon part must be unique across the entire array;
     # see workers/34768
-    descr+=("$i:[$i] $k")
+    descr+=("$i:[$i] ${k//:/\\:}")
     j=${${j# \(}%\)} # strip leading ' (' and trailing ')'
     for j in ${(s:, :)j}; do
       if [[ $j == 'tag: '* ]] ; then

But I haven't tested this, and in any case I won't commit this until you
finish pushing your outstanding changes (to avoid conflicts).

Daniel

> Without this, "git checkout" in a non-git directory would complete " ",
> but not result in a note/error about not being in a git dir.



Messages sorted by: Reverse Date, Date, Thread, Author