zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: update git completion through git 2.13.2
@ 2017-07-13 15:42 Oliver Kiddle
  2017-07-13 16:19 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Kiddle @ 2017-07-13 15:42 UTC (permalink / raw)
  To: Zsh workers

update for a few new options

Oliver

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index f764daf75..98db5b933 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -292,7 +292,7 @@ _git-branch () {
   declare l c m d e
 
   l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev --list --points-at --sort'
-  c='-l --create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --merged --no-merged'
+  c='-l --create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --no-contains --merged --no-merged'
   m='-m --move -M'
   d='-d --delete -D'
   e='--edit-description'
@@ -341,9 +341,10 @@ _git-branch () {
     "($l $m $d $e)--no-track[override the branch.autosetupmerge configuration variable]" \
     "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}"[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names" \
     "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \
-    "($l $m $d $e)--contains=[only list branches which contain the specified commit]: :__git_committishs" \
-    "($l $m $d $e)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \
-    "($l $m $d $e)--no-merged=[don't list branches which are fully contained by HEAD]: :__git_committishs" \
+    "($l $m $d $e)*--contains=[only list branches that contain the specified commit]: :__git_committishs" \
+    "($l $m $d $e)*--no-contains=[only list branches that don't contain the specified commit]: :__git_committishs" \
+    "($l $m $d $e)--merged=[only list branches that are fully contained by HEAD]: :__git_committishs" \
+    "($l $m $d $e)--no-merged=[don't list branches that are fully contained by HEAD]: :__git_committishs" \
     "($c $l $m $d)--edit-description[edit branch description]" \
     $dependent_creation_args \
     "($l $c $d $m $e)"{-m,--move}"[rename a branch and the corresponding reflog]" \
@@ -461,6 +462,7 @@ _git-checkout () {
     '(-)'{-p,--patch}'[interactively select hunks in diff between given tree-ish and working tree]' \
     "--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \
     "--ignore-other-worktrees[don't check if another worktree is holding the given ref]" \
+    '--recurse-submodules=-[control recursive updating of submodules]::checkout:__git_commits' \
     '(-q --quiet)--progress[force progress reporting]' \
     '(-)--[start file arguments]' \
     '*:: :->branch-or-tree-ish-or-file' && ret=0
@@ -628,7 +630,7 @@ _git-clone () {
     '(--single-branch)--no-single-branch[clone history leading up to each branch]' \
     '--shallow-submodules[any cloned submodules will be shallow]' \
     '--recursive[initialize all contained submodules]' \
-    '--recurse-submodules[initialize submodules in the clone]' \
+    '--recurse-submodules=-[initialize submodules in the clone]::file:__git_files' \
     '--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \
     '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \
     '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \
@@ -724,6 +726,7 @@ _git-commit () {
 _git-describe () {
   _arguments -S -s \
     '(*)--dirty=-[describe HEAD, adding mark if dirty]::mark' \
+    '(*)--broken=-[describe HEAD, adding mark if broken]::mark' \
     '--all[use any ref found in "$GIT_DIR/refs/"]' \
     '--tags[use any ref found in "$GIT_DIR/refs/tags"]' \
     '(--tags)--contains[find the tag after the commit instead of before]' \
@@ -732,7 +735,8 @@ _git-describe () {
     '(--candidates              )--exact-match[only output exact matches, same as --candidates=0]' \
     '--debug[display information about the searching strategy]' \
     '(--abbrev)--long[always show full format, even for exact matches]' \
-    '--match=[only consider tags matching glob pattern]:pattern' \
+    '*--match=[only consider tags matching glob pattern]:pattern' \
+    "*--exclude=[don't consider tags matching glob pattern]:pattern" \
     '--always[show uniquely abbreviated commit object as fallback]' \
     '--first-parent[follow only the first parent of merge commits]' \
     '*: :__git_committishs'
@@ -1609,6 +1613,7 @@ _git-stash () {
 
   _arguments -C \
     '*::: :->args' \
+    '(-m --message)'{-m,--message}'[specify stash description]' \
     ${save_arguments//#\(/(* } && ret=0
 
   if [[ -n $state ]]; then
@@ -1616,7 +1621,7 @@ _git-stash () {
       local -a commands
 
       commands=(
-        save:'save your local modifications to a new stash'
+        {push,save}:'save your local modifications to a new stash'
         list:'list the stashes that you currently have'
         show:'show the changes recorded in the stash as a diff'
         pop:'remove and apply a single stashed state from the stash list'
@@ -1638,6 +1643,12 @@ _git-stash () {
             $save_arguments \
             ':: :_guard "([^-]?#|)" message' && ret=0
           ;;
+        (push)
+          _arguments -S \
+            $save_arguments \
+	    '(-m --message)'{-m,--message}'[specify stash description]' \
+            ':: :__git_modified_files' && ret=0
+          ;;
         (list)
           local -a log_options revision_options
           __git_setup_log_options
@@ -1956,7 +1967,8 @@ _git-tag () {
       '(-l --list)'{-l,--list}'[list tags matching pattern]' \
       '(--no-column)--column=-[display tag listing in columns]::column.tag option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \
       '(--column)--no-column[do not display in columns]' \
-      '--contains=[only list tags which contain the specified commit]: :__git_commits' \
+      '*--contains=[only list tags that contain the specified commit]: :__git_commits' \
+      "*--no-contains=[only list tags that don't contain the specified commit]: :__git_commits" \
       '--merged=-[print only tags that are merged]:: :__git_commits' \
       '--no-merged=-[print only tags that are not merged]:: :__git_commits' \
       '--sort=[specify how the tags should be sorted]:mode:((refname\:"lexicographic order"
@@ -4886,7 +4898,8 @@ _git-for-each-ref () {
     '*--points-at=[print only refs which point at the given object]:object:__git_commits' \
     '*--merged=[print only refs that are merged]:object:__git_commits' \
     '*--no-merged=[print only refs that are not merged]:object:__git_commits' \
-    '*--contains=[print only refs which contain the commit]:object:__git_commits' \
+    '*--contains=[print only refs that contain specified commit]:object:__git_commits' \
+    "*--no-contains=[print only refs that don't contain specified commit]:object:__git_commits" \
     '--ignore-case[sorting and filtering are case-insensitive]' \
     '(-s --shell -p --perl --python --tcl)'{-s,--shell}'[use string literals suitable for sh]' \
     '(-s --shell -p --perl --python --tcl)'{-p,--perl}'[use string literals suitable for Perl]' \
@@ -5306,7 +5319,7 @@ _git-check-attr () {
     {-a,--all}'[list all attributes that are associated with the specified paths]' \
     '--stdin[read file names from stdin instead of from command line]' \
     '--cached[consider .gitattributes in the index only, ignoring the working tree.]' \
-    '-z[make output format machine-parseable and treat input-paths as NUL-separated with --stdin]' \
+    '-z[terminate input and output records by a NUL character]' \
     $z_opt \
     '(-)--[interpret preceding arguments as attributes and following arguments as path names]' \
     '*:: :->attribute-or-file' && ret=0


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

* Re: PATCH: update git completion through git 2.13.2
  2017-07-13 15:42 PATCH: update git completion through git 2.13.2 Oliver Kiddle
@ 2017-07-13 16:19 ` Bart Schaefer
  2017-07-14 15:17   ` Oliver Kiddle
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2017-07-13 16:19 UTC (permalink / raw)
  To: Zsh workers

On Thu, Jul 13, 2017 at 8:42 AM, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> update for a few new options

So I think we had a bit if discussion about this before, but:  Is
there any reasonable way for _git to check whether the
options/subcommands/etc. it completes are actually supported by the
installed version of git ?  I'm likely to be running a
recently-rebuilt zsh on hosts where git is tracking the version in the
OS distribution, which is probably quite a bit behind the bleeding
edge.


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

* Re: PATCH: update git completion through git 2.13.2
  2017-07-13 16:19 ` Bart Schaefer
@ 2017-07-14 15:17   ` Oliver Kiddle
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Kiddle @ 2017-07-14 15:17 UTC (permalink / raw)
  To: Zsh workers

Bart wrote:
> So I think we had a bit if discussion about this before, but:  Is
> there any reasonable way for _git to check whether the
> options/subcommands/etc. it completes are actually supported by the
> installed version of git ?  I'm likely to be running a
> recently-rebuilt zsh on hosts where git is tracking the version in the
> OS distribution, which is probably quite a bit behind the bleeding
> edge.

For most cases, we decided against doing this manually (with explicit
conditions comparing version numbers) long ago. I'd sooner spend time
updating more functions to support the latest versions than to add
handling for multiple old versions. Most users will have the opposite
problem to you. If it is particularly bothering you with git, one option
is to do a local build of git on the relevant machine (a few newish git
features have motivated me to do that).

The output of git <subcommand> -h is moderately regular so it might be
possible to do filtering based on that. subcommand filtering might also
be possible but I'm not entirely sure on the best way. For git, we also
have quite a few cases where there are options that assert defaults
where we should be checking git config to see what the configured
default is.

Another approach to this issue is having upstream software include their
own completion functions. This is becoming slightly more common anyway.
It has some advantages (such as this) and some disadvantages (such as if
they ignore my pull requests to update the function). I don't think it'd
be suitable with git but I wish git would remove the broken function
they do distribute which wraps the bash completion.

Oliver


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

end of thread, other threads:[~2017-07-14 15:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-13 15:42 PATCH: update git completion through git 2.13.2 Oliver Kiddle
2017-07-13 16:19 ` Bart Schaefer
2017-07-14 15:17   ` Oliver Kiddle

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