From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29876 invoked by alias); 17 May 2015 19:09:24 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35166 Received: (qmail 2765 invoked from network); 17 May 2015 19:09:21 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU autolearn=ham autolearn_force=no version=3.4.0 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= Message-ID: <5558E75F.2040003@thequod.de> Date: Sun, 17 May 2015 21:09:19 +0200 From: Daniel Hahler User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: zsh-workers@zsh.org Subject: Re: completion: git: various improvements to commit object handling References: <1431527191-32165-1-git-send-email-genml+zsh-workers@thequod.de> In-Reply-To: <1431527191-32165-1-git-send-email-genml+zsh-workers@thequod.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit -----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-----