zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: 3.0.8: git completion update for cherry-pick
@ 2015-07-18 22:19 Mateusz Karbowy
  2015-07-22 11:53 ` Daniel Shahaf
  0 siblings, 1 reply; 15+ messages in thread
From: Mateusz Karbowy @ 2015-07-18 22:19 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-09-01  4:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-18 22:19 PATCH: 3.0.8: git completion update for cherry-pick Mateusz Karbowy
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

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).