Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: git log -1 --...
- X-seq: zsh-workers 36236
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Zsh Hackers' List <zsh-workers@xxxxxxx>
- Subject: Re: git log -1 --...
- Date: Wed, 19 Aug 2015 02:01:14 +0000
- 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=
- In-reply-to: <20150813231350.GA1998@tarsus.local2>
- 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: <20150813120745.6ffc97af@pwslap01u.europe.root.pri> <12769.1439466043@thecus.kiddle.eu> <20150813231350.GA1998@tarsus.local2>
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
From 3af6437ee181fbcb4d1d764d6a7b2e5e098d1dd8 Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
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
From ff8b9df282efbec19319719f67b99cf7d259087a Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author