Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: 3.0.8: git completion update for cherry-pick
- X-seq: zsh-workers 36328
- From: Mateusz Karbowy <mateusz.karbowy@xxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Subject: Re: PATCH: 3.0.8: git completion update for cherry-pick
- Date: Sat, 29 Aug 2015 17:53:57 +0100
- Cc: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=loiPqyiIAxA+4RxasISamCNpA+5MsyfuEC+Xokw2nCQ=; b=Vmneihs1eDQcjQhKRU0A/KCgdMABxGnIUapz31aRns3+fkq7bLF/7OxN8CNW7QzQYN hHMyzmdRxpeZj4g4SB844krInm4x04R+Fv8vY+tBuRYZ1Q485P9n1uidnhsaobAfn9ya pnSjpeBQw/qwwb+4M3V3BRBDVWN26aUrRnlinnBC29N7aF6xkR4fpeFObJk0BoUl3ecm hz/006PfDVb8XEzKJz9tjeGTLfRkSubYaxrELe+4HTPz4vB46QgP2QfUc+JehxVisYx0 5J4WiRl/n73zi5pzvRsbYOpdomwK5MV0UWJna99BnADqyoNqihvg+HaGxCMZP3f4dM/J t5Vw==
- In-reply-to: <20150827232856.GF21994@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: <CAFiR=Jv1ycq5jWvbyHQX=Csjyv8H1xSUKA45Mj6152Why5qhjg@mail.gmail.com> <20150722115307.GC2171@tarsus.local2> <CAFiR=JvJefLthQnoQ2YY-nQF69jgAXo76dzMit7sBRBZVgiq_Q@mail.gmail.com> <20150827231152.GD21994@tarsus.local2> <150827161952.ZM1496@torch.brasslantern.com> <20150827232856.GF21994@tarsus.local2>
Daniel,
I've fixed the no-quotes issue with $@ and now I'm passing both
compadd and git commit options using one -O parameter (the array names
are separated with colon, as you suggested).
Regards,
Obszczymucha
On 28 August 2015 at 00:28, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> Bart Schaefer wrote on Thu, Aug 27, 2015 at 16:19:52 -0700:
>> On Aug 27, 11:11pm, Daniel Shahaf wrote:
>> }
>> } Apart from these two issues, the patch seems ready for commit to me.
>>
>> Let's get this (and 36304) in soon, so PWS can close -test-3 and
>> release 5.1.
>
> I've already pushed 36304.
>
> I don't think this patch needs to delay 5.1; it's not a regression.
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index b8edc10..ef125e4 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -495,6 +495,8 @@ _git-checkout () {
(( $+functions[_git-cherry-pick] )) ||
_git-cherry-pick () {
+ local -a git_commit_opts
+ git_commit_opts=(--all --not HEAD --not)
_arguments \
'(- :)--quit[end revert or cherry-pick sequence]' \
'(- :)--continue[resume revert or cherry-pick sequence]' \
@@ -511,7 +513,7 @@ _git-cherry-pick () {
'*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
'*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \
'(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \
- ': :__git_commit_ranges'
+ ': : __git_commit_ranges -O expl:git_commit_opts'
}
(( $+functions[_git-citool] )) ||
@@ -5602,20 +5604,28 @@ __git_remote_branch_names_noprefix () {
(( $+functions[__git_commit_objects_prefer_recent] )) ||
__git_commit_objects_prefer_recent () {
- __git_recent_commits || __git_commit_objects
+ local -a argument_array_names
+ zparseopts -D -E O:=argument_array_names
+
+ __git_recent_commits $argument_array_names || __git_commit_objects
}
(( $+functions[__git_commits] )) ||
__git_commits () {
+ local -a argument_array_names
+ zparseopts -D -E O:=argument_array_names
+ (( $#argument_array_names )) && argument_array_names=( "${(@s/:/)argument_array_names[2]}" ) && set -- "${(@P)argument_array_names[1]}"
+
# TODO: deal with things that __git_heads and __git_tags has in common (i.e.,
# if both exists, they need to be completed to heads/x and tags/x.
- local -a sopts ropt
+ local -a sopts ropt expl
zparseopts -E -a sopts S: r:=ropt R: q
sopts+=( $ropt:q )
+ expl=( "$@" )
_alternative \
"heads::__git_heads $sopts" \
"commit-tags::__git_commit_tags $sopts" \
- 'commit-objects::__git_commit_objects_prefer_recent'
+ 'commit-objects:: __git_commit_objects_prefer_recent -O expl:$argument_array_names[2]'
}
(( $+functions[__git_heads] )) ||
@@ -5670,13 +5680,17 @@ __git_commit_objects () {
(( $+functions[__git_recent_commits] )) ||
__git_recent_commits () {
local gitdir expl start
- declare -a descr tags heads commits
+ declare -a descr tags heads commits argument_array_names commit_opts
local i j k ret
integer distance_from_head
+ zparseopts -D -E O:=argument_array_names
+ (( $#argument_array_names )) && argument_array_names=( "${(@s/:/)argument_array_names[2]}" )
+ (( $#argument_array_names > 1 )) && commit_opts=( "${(@P)argument_array_names[2]}" )
+
# Careful: most %d will expand to the empty string. Quote properly!
# NOTE: we could use %D directly, but it's not available in git 1.9.1 at least.
- commits=("${(f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s\ \(%cr\)')"}")
+ commits=("${(f)"$(_call_program commits git --no-pager log $commit_opts -20 --format='%h%n%d%n%s\ \(%cr\)')"}")
__git_command_successful $pipestatus || return 1
for i j k in "$commits[@]" ; do
@@ -5759,13 +5773,19 @@ __git_commits2 () {
(( $+functions[__git_commit_ranges] )) ||
__git_commit_ranges () {
- local -a suf
+ local -a argument_array_names
+ zparseopts -D -E O:=argument_array_names
+ (( $#argument_array_names )) && argument_array_names=( "${(@s/:/)argument_array_names[2]}" ) && set -- "${(@P)argument_array_names[1]}"
+
+ local -a expl suf
if compset -P '*..(.|)'; then
- __git_commits $*
+ expl=( $* )
else
compset -S '..*' || suf=( -S .. -r '.@~ ^:\t\n\-' )
- __git_commits $* $suf
+ expl=( $* $suf )
fi
+
+ __git_commits -O expl:$argument_array_names[2]
}
(( $+functions[__git_commit_ranges2] )) ||
Messages sorted by:
Reverse Date,
Date,
Thread,
Author