Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion: git: various improvements to commit object handling
- X-seq: zsh-workers 35166
- From: Daniel Hahler <genml+zsh-workers@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: completion: git: various improvements to commit object handling
- Date: Sun, 17 May 2015 21:09:19 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= content-transfer-encoding:content-type:content-type:in-reply-to :references:subject:subject:mime-version:user-agent:from:from :date:date:message-id:received:received; s=postfix2; t= 1431889759; bh=QnOny7CPSYe0sspY9/E10LsXW6Hmmr5FB5Hzk+7BqUw=; b=k NbkUdadxqKCIWXnehnhhtUW1/k6j3TtK94/0Lsdv6qMcY5Cogj+cCwPeiH0UpliI DJRQV0LwiB9KBMMabaE+lojqR7tcvo/ZLW1T9FfdT+AVsovyppqwzM+OfD6T57+H oawsHGSHr80e/3nI3NUXH5SN87j7MpDQLEBA3lp3sg=
- In-reply-to: <1431527191-32165-1-git-send-email-genml+zsh-workers@thequod.de>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1431527191-32165-1-git-send-email-genml+zsh-workers@thequod.de>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I will push this series later.
- From discussion on IRC with Daniel Shahaf, I've ended up with the following interdiff:
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 858f817..708eb2a 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5675,7 +5675,8 @@ __git_recent_commits () {
integer distance_from_head
# Careful: most %d will expand to the empty string. Quote properly!
- : "${(A)commits::=${(@f)"$(_call_program commits git --no-pager log -20 --format='%h%n%D%n%s\ \(%cr\)')"}}"
+ # NOTE: we could use %D directly, but it's not available in git 1.9.1 at least.
+ : "${(A)commits::=${(@f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s\ \(%cr\)')"}}"
__git_command_successful $pipestatus || return 1
for i j k in "$commits[@]" ; do
@@ -5694,7 +5695,8 @@ __git_recent_commits () {
fi
(( ++distance_from_head ))
- j=${j%% ->*} # Remove " -> master, origin/master" etc.
+ j=${${j# \(}%\)} # strip leading ' (' and trailing ')'
+ j=${j/ ->/,} # Convert " -> master, origin/master".
for j in ${(s:, :)j}; do
if [[ $j == 'tag: '* ]] ; then
tags+=( ${j#tag: } )
@@ -5712,6 +5714,7 @@ __git_recent_commits () {
_wanted heads expl 'head' compadd "$@" -a - heads && ret=0
expl=()
_describe -2Vx -t commits 'recent commit object name' descr && ret=0
+ return $ret
}
(( $+functions[__git_blob_objects] )) ||
Regards,
Daniel.
On 13.05.2015 16:26, Daniel Hahler wrote:
> I've also submitted it as a pull request against the zsh-users' mirror on Github:
> https://github.com/zsh-users/zsh/pull/4
>
> [PATCH 1/7] completion: git: __git_recent_commits: remove ' ->*' from
> [PATCH 2/7] completion: git: use %D for %d, without the " (", ")"
> [PATCH 3/7] completion: git: add __git_commit_objects_prefer_recent
> [PATCH 4/7] completion: git: __git_commit_objects: query 1000 commits
> [PATCH 5/7] completion: git: add %cr to commit objects (all and
> [PATCH 6/7] completion: git: unique name for __git_recent_commits
> [PATCH 7/7] completion: git: add distance_from_head to
>
>
> Regards,
> Daniel.
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iD8DBQFVWOdffAK/hT/mPgARAtgfAKDMwzqAiPBQGR+feZ+aK9gK0Ote5ACg2jHo
reNSvIDJRWAWMNochFIbUBk=
=elZp
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author