Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: 3.0.8: git completion update for cherry-pick
- X-seq: zsh-workers 35821
- From: Mateusz Karbowy <mateusz.karbowy@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: 3.0.8: git completion update for cherry-pick
- Date: Sat, 18 Jul 2015 23:19:05 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=oP2e2iUKp5wrv+pgMBKXpRFAQcqiEN9iwcTJNWi4Fwo=; b=AKq1OIskwVu77B0yBzlH9heGMRswPy5RHzulUMWGYN+lsNhzlzwcHpOeqWJNyG0yL/ dVsNfY5nj2RFv/oH8njlz2Y9U+tLKO2E7ACnuUP2KllQ0HO6Y+xOMASTeE2iMsw5XlRy KYtMXInsp0cdvLBvWknz6lIm/qVa0K7KwO/rjnMr8CUwEjdRFhL/T0XD3uYEokzxUoK0 Jk7lfigPquRs1YT34k5VzD682233gm0IDwhHA1J5R+eM1IlpvPgNyuVhzFlpVfMMksUW ofCDDRPvuo4Gs2ezQDOX+DG1nTe+hLDyjnyWHQKKigaxPvC49zfdydJVlEeFIz5vADOw 7hJQ==
- 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
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author