Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Who is sorting my completion results?
- X-seq: zsh-workers 25555
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: zsh-workers <zsh-workers@xxxxxxxxxx>
- Subject: Who is sorting my completion results?
- Date: Sat, 30 Aug 2008 14:02:14 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=9/3qg+wOWkAkFJSbn5m0xZ1PnQZlFX75hzNj7W4zZQM=; b=ZkRyb/R5VXUOUPe/dXZaFt0qENCXStehJLHTp091Q/1uYBWs/8liwZwx8IVKi8C8vN iv0uU5sSmQ+Ht0yP3VlKB6ino4Necp+qX4PLaCJFhRCzDPs+iF5I7PWR8tulVNMWfY8u ACo/2G4tkQuakKjtLyaLP4KfjJtP0cmMlw5zA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=Ul+I1vPsiT/UfwDemKVxLoc4w7KWJ12YPC5sQQ8V5NMFsA8XwU7DC7lHjOVY+molx8 2seu1roqmhLWkYikDYBK+tK7+wscfnGSxGLf4XOxWGGjXmM7RRIq3trZxjtvU6eVrjux Zc0h8fVmaSjhC6u+0SnNgr7oAjT0QpuS1nzHI=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
I'm trying to add reflog completion for git (nevermind what that is if you don't
know :), they look like foo@{1}, foo@{2}, etc. git reflog gives an
already sorted
list of reflog entries, but when I try my completion in the shell, they are re-
sorted as foo@{1}, foo@{10}, foo@{100}, foo@{2}, etc. Who and why is this list
resorted by? (+grammar).
(( $+functions[__git_heads] )) ||
__git_heads () {
local expl
declare -a branch_names_with_desc branch_names ref_with_desc ref
if [[ $PREFIX = *@* ]]; then
#XXX this gets sorted by sha1 at least from git-checkout which is
obviously bad...
compset -P '*@'
ref_with_desc=(${(f)"$(_call_program reflogentries git reflog show
${IPREFIX%@})"})
__git_command_successful || return
ref=(${ref_with_desc//(#b)*. (*\}):*/$match[1]})
unset PREFIX IPREFIX
_wanted reflog expl reflog-entry compadd $* -ld ref_with_desc - $ref
else
branch_names_with_desc=(${${(f)"$(_call_program headrefs git
for-each-ref --format='"%(refname) [%(subject)]"' refs/heads
refs/remotes 2>/dev/null)"}#refs/(heads|remotes)/})
__git_command_successful || return
branch_names=(${branch_names_with_desc// *})
_wanted heads expl branch-name compadd $* -ld
branch_names_with_desc - $branch_names HEAD
fi
}
--
Mikael Magnusson
PS I lied a bit in the description wrt this code, but it gets true if you
remove -ld ref_with_desc, the results are even worse with it since it gets
sorted by the sha1 hash of the commit. DS
Messages sorted by:
Reverse Date,
Date,
Thread,
Author