From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25891 invoked by alias); 19 Aug 2015 02:01:23 -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: 36236 Received: (qmail 2946 invoked from network); 19 Aug 2015 02:01:20 -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-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=s22O5R8g8x+rvU8wXl+S5lJtSi0=; b=FJ1O37 /Iz+gBF7/j94tGgPaKJCzW9J2xCzmGveF7bF92aqUWLTOCDt8o88BUceBKlRby6X oKDSx4z4HBXQM4hlAhKUD+WMnrqgi0zF8ylgcdupuYni48tWc27VuBFRT0E/fm8j u1LLnqWqpL7SnDgOh8x892e4xa+9WC0loWcYs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=s22O5R8g8x+rvU8wXl+S5lJtSi0=; b=IO0d+ 4ta9xD1i+yGFY+lRkDI4S235iOJNazKPG0NreTBBS5OB/+//jLft3BDYeCJA2DWH sTcaHjNQno/XotUScgeScmCiCaN6bfZYh7ZVdnf/lBJU+oCt+aXVmuCOIltevqSX 5p5kTFdYDaJFUy2cC0XuIM7WR1MfFgrEx8MRig= X-Sasl-enc: q1j6aQDu1B2TiCi4N76UN56A5BKk2gPr/Vkx3dhxSHAk 1439949676 Date: Wed, 19 Aug 2015 02:01:14 +0000 From: Daniel Shahaf To: Zsh Hackers' List Subject: Re: git log -1 --... Message-ID: <20150819020114.GD2005@tarsus.local2> References: <20150813120745.6ffc97af@pwslap01u.europe.root.pri> <12769.1439466043@thecus.kiddle.eu> <20150813231350.GA1998@tarsus.local2> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="+QahgC5+KEYLbs62" Content-Disposition: inline In-Reply-To: <20150813231350.GA1998@tarsus.local2> User-Agent: Mutt/1.5.21 (2010-09-15) --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Daniel Shahaf wrote on Thu, Aug 13, 2015 at 23:13:50 +0000: > There are two additional problems in this code, besides the one you are > fixing: > > 1. The second-word-or-later should complete commit ranges or revspecs > too (as in 'git log origin/master origin/foobar'). > > 2. Using __git_cached_files is wrong since it wouldn't complete files > that are in HEAD but not in the index (i.e., any uncommitted 'git rm'). > Patches for these issues two attached. They are to be applied on top of Oliver's patch from this thread. (They conflict textually but should be independent semantically.) > These are preexisting issues: they weren't caused by your patch and > can be fixed independently of it. ... > P.S. There is an asymmetry between __git_tree_files > / __git_cached_files: the former does 'ls-tree' one directory-tree-level > at a time, the latter gets the 'ls -R' output and lets _multi_parts > handle the one-directory-tree-level-at-a-time part. I'm not sure > which approach is better. > > > return ret --+QahgC5+KEYLbs62 Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="0002-_git-log-complete-git-rm-d-files-too.patch" >>From 3af6437ee181fbcb4d1d764d6a7b2e5e098d1dd8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 18 Aug 2015 04:19:27 +0000 Subject: [PATCH 2/3] _git-log: complete 'git rm'd files --- Completion/Unix/Command/_git | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 25af4fc..90969bd 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1093,11 +1093,11 @@ _git-log () { case $state in (first-commit-ranges-or-files) if [[ -n ${opt_args[(I)--]} ]]; then - __git_cached_files && ret=0 + __git_tree_files ${PREFIX:-.} HEAD && ret=0 else _alternative \ 'commit-ranges::__git_commit_ranges' \ - 'cached-files::__git_cached_files' && ret=0 + 'cached-files::__git_tree_files ${PREFIX:-.} HEAD' && ret=0 fi ;; (commit-ranges-or-files) @@ -1109,7 +1109,7 @@ _git-log () { elif __git_is_committish $line[1]; then __git_tree_files ${PREFIX:-.} $line[1] && ret=0 else - __git_cached_files && ret=0 + __git_tree_files ${PREFIX:-.} HEAD && ret=0 fi ;; esac -- 2.1.4 --+QahgC5+KEYLbs62 Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="0003-_git-log-Complete-multiple-revspecs.patch" >>From ff8b9df282efbec19319719f67b99cf7d259087a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 18 Aug 2015 04:26:48 +0000 Subject: [PATCH 3/3] _git-log: Complete multiple revspecs e.g., git log origin/master origin/foo origin/bar --- Completion/Unix/Command/_git | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 90969bd..6922393 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1101,6 +1101,11 @@ _git-log () { fi ;; (commit-ranges-or-files) + # Multiple revspecs are permitted. + if [[ -z ${opt_args[(I)--]} ]]; then + __git_commit_ranges "$@" && ret=0 + fi + # TODO: Write a wrapper function that checks whether we have a # committish range or comittish and calls __git_tree_files # appropriately. -- 2.1.4 --+QahgC5+KEYLbs62--