From: Mateusz Karbowy <mateusz.karbowy@gmail.com>
To: zsh-workers@zsh.org
Subject: PATCH: 3.0.8: git completion update for cherry-pick
Date: Sat, 18 Jul 2015 23:19:05 +0100 [thread overview]
Message-ID: <CAFiR=Jv1ycq5jWvbyHQX=Csjyv8H1xSUKA45Mj6152Why5qhjg@mail.gmail.com> (raw)
Currently completion for cherry-pick displays recent commits from the
current branch.
This patch changes this to show recent commits from all branches except HEAD.
Obszczymucha
diff --git a/_git b/_git
index b8edc10..8b9eb2b 100644
--- a/_git
+++ b/_git
@@ -511,7 +511,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 --all --not HEAD'
}
(( $+functions[_git-citool] )) ||
@@ -5602,20 +5602,20 @@ __git_remote_branch_names_noprefix () {
(( $+functions[__git_commit_objects_prefer_recent] )) ||
__git_commit_objects_prefer_recent () {
- __git_recent_commits || __git_commit_objects
+ __git_recent_commits $* || __git_commit_objects
}
(( $+functions[__git_commits] )) ||
__git_commits () {
# 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
- zparseopts -E -a sopts S: r:=ropt R: q
+ local -a sopts ropt recentopts
+ zparseopts -E -a sopts S: r:=ropt R: q -all=recentopts -not+:=recentopts
sopts+=( $ropt:q )
_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 $recentopts"
}
(( $+functions[__git_heads] )) ||
@@ -5669,14 +5669,16 @@ __git_commit_objects () {
(( $+functions[__git_recent_commits] )) ||
__git_recent_commits () {
- local gitdir expl start
+ local gitdir expl start opts
declare -a descr tags heads commits
local i j k ret
integer distance_from_head
+ zparseopts -D -E -a opts -- -all -not:
+
# 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 $opts
-20 --format='%h%n%d%n%s\ \(%cr\)')"}")
__git_command_successful $pipestatus || return 1
for i j k in "$commits[@]" ; do
next reply other threads:[~2015-07-18 22:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-18 22:19 Mateusz Karbowy [this message]
2015-07-22 11:53 ` Daniel Shahaf
2015-08-10 21:31 ` Mateusz Karbowy
2015-08-11 22:06 ` Daniel Shahaf
2015-08-19 17:10 ` Mateusz Karbowy
2015-08-21 19:55 ` Mateusz Karbowy
2015-08-23 6:42 ` Daniel Shahaf
2015-08-25 22:26 ` Mateusz Karbowy
2015-08-27 23:11 ` Daniel Shahaf
2015-08-27 23:19 ` Bart Schaefer
2015-08-27 23:28 ` Daniel Shahaf
2015-08-29 16:53 ` Mateusz Karbowy
2015-08-30 22:39 ` Daniel Shahaf
2015-08-31 7:50 ` Mateusz Karbowy
2015-09-01 4:19 ` Daniel Shahaf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFiR=Jv1ycq5jWvbyHQX=Csjyv8H1xSUKA45Mj6152Why5qhjg@mail.gmail.com' \
--to=mateusz.karbowy@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).