zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 0/4] _git: bugfixes, improvements and updates
@ 2014-02-17  4:00 m0viefreak
  2014-02-17  4:00 ` [PATCH 1/4] _git: fix __git_committish_range_{first,last} and __git_is_committish_range m0viefreak
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: m0viefreak @ 2014-02-17  4:00 UTC (permalink / raw)
  To: zsh-workers; +Cc: m0viefreak

Here are a bunch of updates to the git completer.
The last one is a squash of many smaller updates.

m0viefreak (4):
  _git: fix __git_committish_range_{first,last} and
    __git_is_committish_range
  _git: diff: refactor and fix wrong completions
  _git: fix __git_submodules to only use the actual name of the
    submodule
  _git: completion updates up to latest git v1.9.0

 Completion/Unix/Command/_git | 256 ++++++++++++++++++++++++++++++-------------
 1 file changed, 182 insertions(+), 74 deletions(-)

-- 
1.9.0.1.g7244ca4


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

* [PATCH 1/4] _git: fix __git_committish_range_{first,last} and __git_is_committish_range
  2014-02-17  4:00 [PATCH 0/4] _git: bugfixes, improvements and updates m0viefreak
@ 2014-02-17  4:00 ` m0viefreak
  2014-02-17  4:00 ` [PATCH 2/4] _git: diff: refactor and fix wrong completions m0viefreak
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: m0viefreak @ 2014-02-17  4:00 UTC (permalink / raw)
  To: zsh-workers; +Cc: m0viefreak

- Ranges with 3 dots would always fail, because the non-greedy
  expansion  %..(.|)* in __git_committish_range_first would only
  remove '..' and never three dots. 'a...b' would end up in 'a.'.
  Use ${${1%..*}%.} instead.
- Use a similar approach for __git_committish_range_last.
- Wrap them in another expansion to replace empty results with 'HEAD'.
  Git man-page states omitted range ending are being replaced with
  HEAD. This rule has to be followed to make completions like
  'git log foo.. -- <tab>' work properly.
- Add an additional check to make sure none of the extracted first/last
  parts contain additional '..' in invalied ranges such as 'a..b..c'.
  This gets rid of the 'TODO:' and ideally saves a few unneded
  calls to git rev-parse.
---
 Completion/Unix/Command/_git | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index c09f255..8562ab2 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -4798,12 +4798,12 @@ __git_command_successful () {
 
 (( $+functions[__git_committish_range_first] )) ||
 __git_committish_range_first () {
-  print -r -- ${1%..(.|)*}
+  print -r -- ${${${1%..*}%.}:-HEAD}
 }
 
 (( $+functions[__git_committish_range_last] )) ||
 __git_committish_range_last () {
-  print -r -- ${1##*..(.|)}
+  print -r -- ${${${1#*..}#.}:-HEAD}
 }
 
 (( $+functions[__git_pattern_escape] )) ||
@@ -4832,12 +4832,12 @@ __git_is_treeish () {
 
 (( $+functions[__git_is_committish_range] )) ||
 __git_is_committish_range () {
-  # TODO: This isn't quite right.  We would like to do parts=${(~s:..(.|))},
-  # but that doesn't work.  (This would allow us to make sure that parts only
-  # contains two elements and then apply __git_is_committish on them.
-  [[ $1 == *..(.|)* ]] &&
-    __git_is_committish $(__git_committish_range_first $1) &&
-    __git_is_committish $(__git_committish_range_last $1)
+  [[ $1 == *..(.|)* ]] || return 1
+  local first=$(__git_committish_range_first $1)
+  local last=$(__git_committish_range_last $1)
+  [[ $first != *..* && $last != *..* ]] && \
+    __git_is_committish $first && \
+    __git_is_committish $last
 }
 
 (( $+functions[__git_is_initial_commit] )) ||
-- 
1.9.0.1.g7244ca4


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

* [PATCH 2/4] _git: diff: refactor and fix wrong completions
  2014-02-17  4:00 [PATCH 0/4] _git: bugfixes, improvements and updates m0viefreak
  2014-02-17  4:00 ` [PATCH 1/4] _git: fix __git_committish_range_{first,last} and __git_is_committish_range m0viefreak
@ 2014-02-17  4:00 ` m0viefreak
  2014-02-18 11:24   ` Frank Terbeck
  2014-02-17  4:00 ` [PATCH 3/4] _git: fix __git_submodules to only use the actual name of the submodule m0viefreak
  2014-02-17  4:00 ` [PATCH 4/4] _git: completion updates up to latest git v1.9.0 m0viefreak
  3 siblings, 1 reply; 6+ messages in thread
From: m0viefreak @ 2014-02-17  4:00 UTC (permalink / raw)
  To: zsh-workers; +Cc: m0viefreak

Before this, there were several cases where the completion
would offer the wrong things:

$ git diff branch -- <tab>

would try to complete "changed in workdir files", but needs to
complete all "tree files in HEAD".

$ git diff --cached -- file1 file2 <tab>
would try to complete "changed in workdir files" but needs to
complete "changed in index files".

...

After this change all possible combinations are taken into
account and completion should work properly.
---
 Completion/Unix/Command/_git | 75 +++++++++++++++++++++++++-------------------
 1 file changed, 42 insertions(+), 33 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 8562ab2..8105501 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -722,63 +722,72 @@ _git-diff () {
 
   case $state in
     (from-to-file)
+      # If "--" is part of $opt_args, this means it was specified before any $words arguments. This means that no heads are specified in front, so we need to complete *changed* files only.
+      if [[ -n ${opt_args[(I)--]} ]]; then
+        if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
+          __git_changed-in-index_files && ret=0
+        else
+          __git_changed-in-working-tree_files && ret=0
+        fi
+        return ret
+      fi
+
+      # Otherwise, more complex conditions need to be checked.
       case $CURRENT in
         (1)
-          if [[ -n ${opt_args[(I)--]} ]]; then
-            if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
-              __git_changed-in-index_files && ret=0
-            else
-              __git_changed-in-working-tree_files && ret=0
-            fi
-          else
-            local files_alt='files::__git_changed-in-working-tree_files'
-
-            if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
-              files_alt='files::__git_changed-in-index_files'
-            fi
-
-            _alternative \
-              'commit-ranges::__git_commit_ranges' \
-              'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \
-              $files_alt \
-              'blobs::__git_blobs ' && ret=0
+          local files_alt='files::__git_changed-in-working-tree_files'
+          if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
+            files_alt='files::__git_changed-in-index_files'
           fi
+
+          _alternative \
+            'commit-ranges::__git_commit_ranges' \
+            'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \
+            $files_alt \
+            'blobs::__git_blobs ' && ret=0
           ;;
         (2)
+          # Check if first argument is something special. In case of committish ranges and committishs offer a full list compatible completions.
           if __git_is_committish_range $line[1]; then
+            # Example: git diff branch1..branch2 <tab>
             __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0
           elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then
-            if [[ -n ${opt_args[(I)--]} ]]; then
-              __git_changed-in-working-tree_files && ret=0
-            else
-              _alternative \
-                'commits::__git_commits' \
-                'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \
-                'files::__git_changed-in-working-tree_files' && ret=0
-            fi
+            # Example: git diff branch1 <tab>
+            _alternative \
+              'commits::__git_commits' \
+              'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \
+              'files::__git_tree_files ${PREFIX:-.} HEAD' && ret=0
           elif __git_is_blob $line[1]; then
-            if [[ -n ${opt_args[(I)--]} ]]; then
-              __git_cached_files && ret=0
-            else
-              _alternative \
-                'files::__git_cached_files' \
-                'blobs::__git_blobs' && ret=0
-            fi
+            _alternative \
+              'files::__git_cached_files' \
+              'blobs::__git_blobs' && ret=0
           elif [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
+            # Example: git diff --cached file1 <tab>
             __git_changed-in-index_files && ret=0
           else
+            # Example: git diff file1 <tab>
             __git_changed-in-working-tree_files && ret=0
           fi
           ;;
         (*)
           if __git_is_committish_range $line[1]; then
+            # Example: git diff branch1..branch2 file1 <tab>
             __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0
           elif { __git_is_committish $line[1] && __git_is_committish $line[2] } ||
               __git_is_treeish $line[2]; then
+            # Example: git diff branch1 branch2 <tab>
             __git_tree_files ${PREFIX:-.} $line[2] && ret=0
+          elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then
+            # Example: git diff branch file1 <tab>
+            # Example: git diff branch -- f<tab>
+            __git_tree_files ${PREFIX:-.} HEAD && ret=0
           elif __git_is_blob $line[1] && __git_is_blob $line[2]; then
             _nothing
+          elif [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
+            # Example: git diff --cached file1 file2 <tab>
+            __git_changed-in-index_files && ret=0
           else
+            # Example: git diff file1 file2 <tab>
             __git_changed-in-working-tree_files && ret=0
           fi
           ;;
-- 
1.9.0.1.g7244ca4


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

* [PATCH 3/4] _git: fix __git_submodules to only use the actual name of the submodule
  2014-02-17  4:00 [PATCH 0/4] _git: bugfixes, improvements and updates m0viefreak
  2014-02-17  4:00 ` [PATCH 1/4] _git: fix __git_committish_range_{first,last} and __git_is_committish_range m0viefreak
  2014-02-17  4:00 ` [PATCH 2/4] _git: diff: refactor and fix wrong completions m0viefreak
@ 2014-02-17  4:00 ` m0viefreak
  2014-02-17  4:00 ` [PATCH 4/4] _git: completion updates up to latest git v1.9.0 m0viefreak
  3 siblings, 0 replies; 6+ messages in thread
From: m0viefreak @ 2014-02-17  4:00 UTC (permalink / raw)
  To: zsh-workers; +Cc: m0viefreak

The output of 'submodule status' is

Xsha1 name (describe)

X being one of -,+,U,[space]

We are only interested in the name part and not the whole line.

Fix the parameter expansions accordingly.
---
 Completion/Unix/Command/_git | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 8105501..40a86bf 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5546,7 +5546,7 @@ __git_submodules () {
   local expl
   declare -a submodules
 
-  submodules=(${${(f)"$(_call_program submodules git submodule 2>/dev/null)"}#* })
+  submodules=(${${${(f)"$(_call_program submodules git submodule 2>/dev/null)"}#?* }%% *})
   __git_command_successful $pipestatus || return 1
 
   _wanted submodules expl submodule compadd $* - $submodules
-- 
1.9.0.1.g7244ca4


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

* [PATCH 4/4] _git: completion updates up to latest git v1.9.0
  2014-02-17  4:00 [PATCH 0/4] _git: bugfixes, improvements and updates m0viefreak
                   ` (2 preceding siblings ...)
  2014-02-17  4:00 ` [PATCH 3/4] _git: fix __git_submodules to only use the actual name of the submodule m0viefreak
@ 2014-02-17  4:00 ` m0viefreak
  3 siblings, 0 replies; 6+ messages in thread
From: m0viefreak @ 2014-02-17  4:00 UTC (permalink / raw)
  To: zsh-workers; +Cc: m0viefreak

- cherry-pick: allow commit ranges to be specified
- push: option is called --set-upstream and not --set-upstream-to
- status: offer -b,--branch when --porcelain or -z are given
  --porcelain and -z don't show the branch info by default, so it
  is needed to offer --branch for those options, too.
- checkout: add '--detach' option
- checkout: offer '-l' option when '--orphan' was given
- show-ref: update wording of --head and --heads according to man-page
- config: update default value for color.ui
  color-bool was changed to accept a default value as $parts[5]
- add support for 'cygstart' as a valid builtin browser on cygwin
- rebase: add suuport for --autostash and config.autostash
- update builtin browser list
- grep: add --{no,}textconv
- check-ignore: add --no-index
- update-ref: add --stdin -z
- add -C
- pull: add support for --rebase=preserve
- config: add support for http.*. options
- blame: -L can be given multiple times
- config: add support for http.savecookies
- push: add support for --force-with-lease
- diff: --diff-filter: allow lower-case variants (all-but ... specs)
- config: add support for 'fetch.prune' and 'remote.*.prune'
- check-ignore: -z: update message, check-attr: add -z
- config: add diff.orderfile
- revision options: add --exclude
- revision options: add --ignore-missing
- revision options: add --bisect
- rev-parse: add --stuck-long
- merge-base: add --fork-point
- config: implement submodule.*.update completion
- send-email: add --smtp-ssl-cert-path and config options
---
 Completion/Unix/Command/_git | 163 ++++++++++++++++++++++++++++++++++---------
 1 file changed, 131 insertions(+), 32 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 40a86bf..b2b7e12 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -405,8 +405,9 @@ _git-check-ignore () {
     '(-q --quiet)'{-q,--quiet}'[do not output anything, just set exit status]' \
     '(-v --verbose)'{-v,--verbose}'[output details about the matching pattern (if any) for each pathname]' \
     '--stdin[read file names from stdin instead of from the command-line]' \
-    '-z[make output format machine-parseable]' \
+    '-z[make output format machine-parseable and treat input-paths as NUL-separated with --stdin]' \
     '(-n --non-matching)'{-n,--non-matching}'[show given paths which do not match any pattern]' \
+    '--no-index[do not look in the index when undertaking the checks]' \
     '*:: :->file' && ret=0
 }
 
@@ -422,7 +423,7 @@ _git-checkout () {
   # and perhaps also allow all that just with ^{tree} and so on.  Not quite sure
   # how to do that, though.
   local new_branch_reflog_opt
-  if (( words[(I)-b|-B] )); then
+  if (( words[(I)-b|-B|--orphan] )); then
     new_branch_reflog_opt="(--patch)-l[create the new branch's reflog]"
   fi
 
@@ -434,12 +435,13 @@ _git-checkout () {
     '(-f --force -m --merge --conflict --patch)'{-f,--force}'[force branch switch/ignore unmerged entries]' \
     '(-q --quiet        --theirs --patch)--ours[check out stage #2 for unmerged paths]' \
     '(-q --quiet --ours          --patch)--theirs[check out stage #3 for unmerged paths]' \
-    '(   -B --orphan --ours --theirs --conflict --patch)-b[create a new branch based at given commit]: :__git_branch_names' \
-    '(-b    --orphan --ours --theirs --conflict --patch)-B[create or update branch based at given commit]: :__git_branch_names' \
-    '(-t --track --orphan --patch)'{-t,--track}'[set up configuration so pull merges from the base commit]' \
+    '(   -B --orphan --ours --theirs --conflict --patch --detach)-b[create a new branch based at given commit]: :__git_branch_names' \
+    '(-b    --orphan --ours --theirs --conflict --patch --detach)-B[create or update branch based at given commit]: :__git_branch_names' \
+    '(-t --track --orphan --patch --detach)'{-t,--track}'[set up configuration so pull merges from the base commit]' \
     '(--patch)--no-track[override the branch.autosetupmerge configuration variable]' \
     $new_branch_reflog_opt \
-    '(-b -B -t --track --patch)--orphan[create a new orphan branch based at given commit]: :__git_branch_names' \
+    '(-b -B -t --track --patch --orphan)--detach[detach the HEAD at named commit]' \
+    '(-b -B -t --track --patch --detach)--orphan[create a new orphan branch based at given commit]: :__git_branch_names' \
     '--ignore-skip-worktree-bits[ignores patterns and adds back any files in <paths>]' \
     '(-q --quiet -f --force -m --merge --conflict --patch)'{-m,--merge}'[3way merge current branch, working tree and new branch]' \
     '(-q --quiet -f --force -m --merge --patch)--conflict[same as --merge, using given merge style]:style:(merge diff3)' \
@@ -461,7 +463,7 @@ _git-checkout () {
               tree_ish_arg='tree-ishs::__git_tree_ishs' \
               file_arg='modified-files::__git_modified_files'
 
-        if [[ -n ${opt_args[(I)-b|-B|--orphan]} ]]; then
+        if [[ -n ${opt_args[(I)-b|-B|--orphan|--detach]} ]]; then
           remote_branch_noprefix_arg=
           tree_ish_arg=
           file_arg=
@@ -480,7 +482,7 @@ _git-checkout () {
           $remote_branch_noprefix_arg \
           $tree_ish_arg \
           $file_arg && ret=0
-      elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan]} ]]; then
+      elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan|--detach]} ]]; then
         _nothing
       elif [[ -n $line[1] ]] && __git_is_treeish $line[1]; then
         __git_ignore_line __git_tree_files ${PREFIX:-.} $line[1] && ret=0
@@ -509,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_revisions'
+    ': :__git_commit_ranges'
 }
 
 (( $+functions[_git-citool] )) ||
@@ -920,6 +922,8 @@ _git-grep () {
     '(--no-exclude-standard)--exclude-standard[exclude files standard ignore mechanisms]' \
     '--untracked[search in untracked files]' \
     '(-a --text)'{-a,--text}'[process binary files as if they were text]' \
+    '(--textconv --no-textconv)--textconv[honor textconv filter settings]' \
+    '(--textconv --no-textconv}--no-textconv[do not honor textconv filter settings]' \
     '(-i --ignore-case)'{-i,--ignore-case}'[ignore case when matching]' \
     '-I[do not match pattern in binary files]' \
     '--max-depth=[descend at most given levels of directories]: :__git_guard_number depth' \
@@ -1239,8 +1243,10 @@ _git-pull () {
 
   _arguments \
     $merge_options \
-    '(         --no-rebase)--rebase[perform a rebase after fetching]' \
-    '(--rebase            )--no-rebase[do not perform a rebase after fetching]' \
+    '(-r --rebase --no-rebase)'{-r=-,--rebase=-}'[perform a rebase after fetching]::rebase after fetching:((true\:"rebase after fetching"
+                                                                                                        false\:"merge after fetching"
+                                                                                                        preserve\:"rebase and preserve merges"))' \
+    '(-r --rebase            )--no-rebase[do not perform a rebase after fetching]' \
     $fetch_options \
     ': :__git_any_repositories' \
     '*: :__git_ref_specs'
@@ -1248,6 +1254,7 @@ _git-pull () {
 
 (( $+functions[_git-push] )) ||
 _git-push () {
+  local ret=1
   # NOTE: For --receive-pack we use _files to complete, even though this will
   # only complete files on the local end, not the remote end.  Still, it may be
   # helpful to get some sort of completion going, perhaps modifying the path
@@ -1262,9 +1269,11 @@ _git-push () {
     '--tags[all tags under refs/tags are pushed]' \
     '--follow-tags[also push missing annotated tags reachable from the pushed refs]' \
     '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote git-receive-pack:_files' \
+    '(--force-with-lease --no-force-with-lease)*--force-with-lease=-[allow refs that are not ancestors to be updated if current ref matches expected value]::ref and expectation:->lease' \
+    '(--force-with-lease --no-force-with-lease)--no-force-with-lease=-[cancel all previous force-with-lease specifications]' \
     '(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]' \
     '(:)--repo=[default repository to use]:repository:__git_any_repositories' \
-    '(-u --set-upstream-to)'{-u,--set-upstream-to}'[add upstream reference for each branch that is up to date or pushed]' \
+    '(-u --set-upstream)'{-u,--set-upstream}'[add upstream reference for each branch that is up to date or pushed]' \
     '(       --no-thin)--thin[try to minimize number of objects to be sent]' \
     '(--thin          )--no-thin[do not try to minimize number of objects to be sent]' \
     '(-q --quiet -v --verbose --progress)'{-q,--quiet}'[suppress all output]' \
@@ -1274,7 +1283,20 @@ _git-push () {
     '--recurse-submodules=[submodule handling]:submodule handling:((check\:"refuse pushing of supermodule if submodule commit cannot be found on the remote"
                                                                     on-demand\:"push all changed submodules"))' \
     ':: :__git_any_repositories' \
-    '*: :__git_ref_specs'
+    '*: :__git_ref_specs' && ret=0
+
+  case $state in
+    (lease)
+       compset -P '*:'
+       if [[ -n ${IPREFIX#*=} ]]; then
+         _guard '[[:xdigit:]]#' "expected value" && ret=0
+       else
+         __git_remote_branch_names_noprefix && ret=0
+       fi
+      ;;
+  esac
+
+  return ret
 }
 
 (( $+functions[_git-rebase] )) ||
@@ -1309,6 +1331,8 @@ _git-rebase () {
     {-x,--exec}'[with -i\: append "exec <cmd>" after each line]:command' \
     '(1)--root[rebase all reachable commits]' \
     $autosquash_opts \
+    '(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \
+    '(--autostash --no-autostash)--no-autostash[do not stash uncommitted changes before rebasing and apply them afterwards]' \
     '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \
     '--onto[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \
     ':upstream branch:__git_revisions' \
@@ -1565,7 +1589,7 @@ _git-stash () {
 _git-status () {
   local -a branch_opts
 
-  if (( $words[(I)-s|--short] )); then
+  if (( $words[(I)-s|--short|--porcelain|-z] )); then
     branch_opts=('(-b --branch)'{-b,--branch}'[show branch and tracking info]')
   fi
 
@@ -1898,13 +1922,13 @@ _git-config () {
     'browser.*.cmd:browser command to use:browser:_path_commands'
     'browser.*.path:path to use for the browser:absolute browser path:_files -g "*(*)"'
     clean.requireForce:'require --force for git clean to actually do something::->bool:true'
-    color.branch:'color output of git branch::->color-bool'
+    color.branch:'color output of git branch::->color-bool:false'
     color.branch.current:'color of the current branch::->color'
     color.branch.local:'color of a local branch::->color'
     color.branch.remote:'color of a remote branch::->color'
     color.branch.upstream:'color of upstream branches::->color'
     color.branch.plain:'color of other branches::->color'
-    color.diff:'color output of git diff::->color-bool'
+    color.diff:'color output of git diff::->color-bool:false'
     color.diff.plain:'color of context text::->color'
     color.diff.meta:'color of meta-information::->color'
     color.diff.frag:'color of hunk headers::->color'
@@ -1918,7 +1942,7 @@ _git-config () {
     color.decorate.tag:'color of tags::->color'
     color.decorate.stash:'color of stashes::->color'
     color.decorate.HEAD:'color of HEAD::->color'
-    color.grep:'whether or not to color output of git grep::->color-bool'
+    color.grep:'whether or not to color output of git grep::->color-bool:false'
     color.grep.context:'color of non-matching text in context lines::->color'
     color.grep.filename:'color of filename prefix::->color'
     color.grep.function:'color of function name lines::->color'
@@ -1926,14 +1950,14 @@ _git-config () {
     color.grep.match:'color of matching text::->color'
     color.grep.selected:'color of non-matching text in selected lines::->color'
     color.grep.separator:'color of separators between fields in a line::->color'
-    color.interactive:'whether or not to color in interactive mode::->color-bool'
+    color.interactive:'whether or not to color in interactive mode::->color-bool:false'
     color.interactive.prompt:'color of prompt::->color'
     color.interactive.header:'color of header::->color'
     color.interactive.help:'color of help::->color'
     color.interactive.error:'color of error::->color'
     color.pager:'feed colored output to pager::->bool:true'
-    color.showbranch:'color output of git show-branch::->color-bool'
-    color.status:'color output of git status::->color-bool'
+    color.showbranch:'color output of git show-branch::->color-bool:false'
+    color.status:'color output of git status::->color-bool:false'
     color.status.branch:'color of the current branch::->color'
     color.status.header:'color of header text::->color'
     color.status.added:'color of added, but not yet committed, files::->color'
@@ -1941,7 +1965,7 @@ _git-config () {
     color.status.changed:'color of changed, but not yet added in the index, files::->color'
     color.status.untracked:'color of files not currently being tracked::->color'
     color.status.nobranch:'color of no-branch warning::->color'
-    color.ui:'color output of capable git commands::->color-bool'
+    color.ui:'color output of capable git commands::->color-bool:auto'
     commit.cleanup:'default --cleanup option::->commit.cleanup:default'
     commit.status:'include status information in commit message template::->bool:true'
     commit.template:'template file for commit messages:template:_files'
@@ -1958,6 +1982,7 @@ _git-config () {
     diff.external:'command to generate diff with:diff command:_path_commands'
     diff.mnemonicprefix:'use mnemonic source and destination prefixes::->bool:false'
     diff.noprefix:'strip source and destination prefixes::->bool:false'
+    diff.orderfile:'file to read patch order glob patterns from:order file:_files'
     diff.renameLimit:'number of files to consider when detecting copy/renames:rename limit:->int'
     diff.renames:'try to detect renames::->diff.renames:true'
     diff.ignoreSubmodules:'ignore submodules::->bool:false'
@@ -1970,6 +1995,7 @@ _git-config () {
     difftool.prompt:'prompt before each invocation of the diff tool::->bool:true'
     diff.wordRegex:'regex used to determine what a word is when performing word-by-word diff:regular expression:->string'
     diff.guitool:'diff tool with gui to use::__git_difftools'
+    fetch.prune:'remove any remote tracking branches that no longer exist remotely::->bool:false'
     fetch.unpackLimit:'maximum number of objects to unpack when fetching:unpack limit:->int'
     fetch.recurseSubmodules:'recurse into submodules (as needed) when fetching::->fetch.recurseSubmodules:on-demand'
     fetch.fsckObjects:'check all fetched objects::->bool:false'
@@ -2052,13 +2078,14 @@ _git-config () {
     grep.lineNumber:'enable -n option by default::->bool:false'
     grep.patternType:'default matching pattern type::->grep.patternType:default'
     help.browser:'browser used to display help in web format::__git_browsers'
-    http.cookiefile:'file containing cookie lines which should be used in the Git http session::_files'
     help.htmlpath:'location of HTML help::->help.htmlpath'
+    http.cookiefile:'file containing cookie lines which should be used in the Git http session::_files'
     http.lowSpeedLimit:'limit controlling when to abort an HTTP transfer:speed limit:->int'
     http.lowSpeedTime:'limit controlling when to abort an HTTP transfer:time limit (seconds):->int'
     help.format:'default help format used by git help::->help.format'
     help.autocorrect:'execute corrected mistyped commands::->bool:false'
     http.proxy:'HTTP proxy to use:proxy:_urls'
+    http.savecookies:'save cookies to the cookie file::->bool:false'
     http.sslVerify:'verify the SSL certificate for HTTPS::->bool:true'
     http.sslCert:'file containing SSL certificates for HTTPS:SSL certificate file:_files'
     http.sslKey:'file containing the SSL private key for HTTPS:SSL private key file:_files'
@@ -2076,6 +2103,30 @@ _git-config () {
     http.getanyfile:'allow clients to read any file within repository::->bool:true'
     http.uploadpack:'serve git fetch-pack and git ls-remote clients::->bool:true'
     http.receivepack:'serve git send-pack clients::->bool:true'
+    'http.*.cookiefile:file containing cookie lines which should be used in the Git http session::_files'
+    'http.*.lowSpeedLimit:limit controlling when to abort an HTTP transfer:speed limit:->int'
+    'http.*.lowSpeedTime:limit controlling when to abort an HTTP transfer:time limit (seconds):->int'
+    'help.*.format:default help format used by git help::->help.format'
+    'help.*.autocorrect:execute corrected mistyped commands::->bool:false'
+    'http.*.proxy:HTTP proxy to use:proxy:_urls'
+    'http.*.savecookies:save cookies to the cookie file::->bool:false'
+    'http.*.sslVerify:verify the SSL certificate for HTTPS::->bool:true'
+    'http.*.sslCert:file containing SSL certificates for HTTPS:SSL certificate file:_files'
+    'http.*.sslKey:file containing the SSL private key for HTTPS:SSL private key file:_files'
+    'http.*.sslCertPasswordProtected:prompt for a password for the SSL certificate::->bool:false'
+    'http.*.sslCAInfo:file containing CA certificates to verify against for HTTPS:CA certificates file:_files'
+    'http.*.sslCAPath:directory containing files with CA certificates to verify against for HTTPS:CA certificates directory:_directories'
+    'http.*.sslTry:attempt to use AUTH SSL/TLS and encrypted data transfers when connecting via regular FTP protocol::->bool:false'
+    'http.*.maxRequests:how many HTTP requests to launch in parallel:maximum number of requests::->int:5'
+    'http.*.minSessions:number of curl sessions to keep across requests:minimum number of sessions::->int:1'
+    'http.*.postBuffer:maximum size of buffer used by smart HTTP transport when POSTing:maximum POST buffer size:->bytes:1m'
+    'http.*.lowSpeedLimit:lower limit for HTTP transfer-speed:low transfer-speed limit:->int'
+    'http.*.lowSpeedTime:duration for http.lowSpeedLimit:time:->int'
+    'http.*.noEPSV:disable the use of the EPSV ftp-command::->bool:false'
+    'http.*.useragent:user agent presented to HTTP server:user agent string:->string'
+    'http.*.getanyfile:allow clients to read any file within repository::->bool:true'
+    'http.*.uploadpack:serve git fetch-pack and git ls-remote clients::->bool:true'
+    'http.*.receivepack:serve git send-pack clients::->bool:true'
     i18n.commitEncoding:'character encoding commit messages are stored in::->encoding'
     i18n.logOutputEncoding:'character encoding commit messages are output in::->encoding'
     imap.folder:'IMAP folder to use with git imap-send:IMAP folder name::_mailboxes'
@@ -2140,11 +2191,12 @@ _git-config () {
     pack.indexVersion:'default pack index version:index version:->string'
     pack.packSizeLimit:'maximum size of packs:maximum size of packs:->bytes'
     pull.octopus:'default merge strategy to use when pulling multiple branches::__git_merge_strategies'
-    pull.rebase:'rebase branches on top of the fetched branch, instead of merging::->bool:false'
+    pull.rebase:'rebase branches on top of the fetched branch, instead of merging::->pull.rebase:false'
     pull.twohead:'default merge strategy to use when pulling a single branch::__git_merge_strategies'
     push.default:'action git push should take if no refspec is given::->push.default:matching'
     rebase.stat:'show a diffstat of what changed upstream since last rebase::->bool:false'
     rebase.autosquash:'autosquash by default::->bool:false'
+    rebase.autostash:'autostash by default::->bool:false'
     receive.autogc:'run git gc --auto after receiving data::->bool:true'
     receive.fsckObjects:'check all received objects::->bool:true'
     receive.hiderefs:'string(s) receive-pack uses to decide which refs to omit from its initial advertisement:hidden refs:->string'
@@ -2158,6 +2210,7 @@ _git-config () {
     'remote.*.url:URL of a remote repository::__git_any_repositories'
     'remote.*.pushurl:push URL of a remote repository::__git_any_repositories'
     'remote.*.proxy:URL of proxy to use for a remote repository::_urls'
+    'remote.*.prune:remove any remote tracking branches that no longer exist remotely::->bool:false'
     'remote.*.fetch:default set of refspecs for git fetch::__git_ref_specs'
     'remote.*.push:default set of refspecs for git push::__git_ref_specs'
     'remote.*.mirror:push with --mirror::->bool:false'
@@ -2193,6 +2246,7 @@ _git-config () {
     sendemail.smtpserver:'SMTP server to connect to:smtp host:_hosts'
     sendemail.smtpserveroption:'specifies the outgoing SMTP server option to use:SMTP server option:->string'
     sendemail.smtpserverport:'port to connect to SMTP server on:smtp port:_ports'
+    sendemail.smtpsslcertpath:'path to ca-certificates (directory or file):ca certificates path:_files'
     sendemail.smtpuser:'user to use for SMTP-AUTH:smtp user:_users'
     sendemail.thread:'set In-Reply-To\: and References\: headers::->bool:true'
     sendemail.validate:'perform sanity checks on patches::->bool:true'
@@ -2232,7 +2286,7 @@ _git-config () {
     'submodule.*.fetchRecurseSubmodules:fetch commits of submodules::->bool'
     'submodule.*.path:path within project:submodule directory:_directories -qS \:'
     'submodule.*.url:URL to update from::__git_any_repositories'
-    'submodule.*.update:update strategy to use::->submodule.update'
+    'submodule.*.update:update strategy to use::->submodule.update:none'
     'submodule.*.ignore:ignore modifications to submodules with git status and git diff-*::->submodule.ignore'
     svn.noMetadata:'disable git-svn-id: lines at end of commits::->bool:false'
     svn.useSvmProps:'use remappings of URLs and UUIDs from mirrors::->bool:false'
@@ -2310,6 +2364,7 @@ _git-config () {
           'gc.*.:${${line[1]#gc.}%.*}-specific gc option'
           'gitcvs.*.:gitcvs ${${line[1]#gitcvs.}%.*}-specific option'
           'guitool.*.:${${line[1]#guitool.}%.*}-specific option'
+          'http.*.:${${line[1]#http.}%.*}-specific option'
           'man.*.:${${line[1]#man.}%.*}-specific man option'
           'merge.*.:${${line[1]#merge.}%.*}-specific merge option'
           'mergetool.*.:${${line[1]#mergetool.}%.*}-specific option'
@@ -2367,6 +2422,9 @@ _git-config () {
           (guitool.)
             __git_config_sections '^guitool\..+\.[^.]+$' guitools 'gui tool' -S . && ret=0
             ;;
+          (http.)
+            __git_config_sections '^http\..+\.[^.]+$' bases base -S . && ret=0
+            ;;
           (man.)
             __git_man_viewers -S . && ret=0
             ;;
@@ -2577,7 +2635,7 @@ _git-config () {
               esac
               ;;
             (color-bool)
-              __git_config_values -t booleans -l boolean -- "$current" false \
+              __git_config_values -t booleans -l boolean -- "$current" "$parts[5]" \
                 {never,false,no,off}:"do not $parts[2]" \
                 always:"always $parts[2]" \
                 {auto,true,yes,on}:$parts[2] && ret=0
@@ -2758,6 +2816,12 @@ _git-config () {
             (permission)
               __git_repository_permissions && ret=0
               ;;
+            (pull.rebase)
+              __git_config_values -- "$current" "$parts[5]" \
+                {true,yes,on}:$parts[2] \
+                {false,no,off}:"do not $parts[2]" \
+                preserve:"rebase and preserve merges" && ret=0
+              ;;
             (push.default)
               __git_config_values -- "$current" "$parts[5]" \
                 nothing:'do not push anything' \
@@ -2811,6 +2875,18 @@ _git-config () {
                 _message "${parts[3]:-${parts[2]:-value}}"
               fi
               ;;
+            (submodule.update)
+              compset -P '*!'
+              if [[ -n $IPREFIX ]]; then
+                _command_names -e
+              else
+                __git_config_values -- "$current" "$parts[5]" \
+                rebase:'rebase current branch onto commit recorded in superproject' \
+                merge:'merge commit recorded in superproject into current branch of submodule' \
+                none:'do not merge or rebase' \
+                '!:specify command name that takes sha1 to update to as parameter' && ret=0
+              fi
+              ;;
             (submodule.ignore)
               __git_config_values -- "$current" "$parts[5]" \
                 all:'never consider submodules modified' \
@@ -3164,7 +3240,7 @@ _git-blame () {
     '-b[show blank SHA-1 for boundary commits]' \
     '--root[do not treat root commits as boundaries]' \
     '--show-stats[include additional statistics at the end of blame output]' \
-    '-L[annotate only the given line range]: :->line-range' \
+    '*-L[annotate only the given line range]: :->line-range' \
     '-l[show long rev]' \
     '-t[show raw timestamp]' \
     '-S[use revs from revs-file]:revs-file:_files' \
@@ -3362,6 +3438,7 @@ _git-rev-parse () {
         '(- *)'{-h,--help}'[display usage]' \
         '--keep-dashdash[do not skip first -- option]' \
         '--stop-at-non-option[stop parsing options at first non-option argument]' \
+        '--stuck-long[output options in long form if available, and with their arguments stuck]' \
         '*:option specification' && ret=0
     fi
   elif (( words[(I)--sq-quote] )); then
@@ -3589,6 +3666,7 @@ _git-send-email () {
     '--smtp-server=[specify SMTP server to connect to]:smtp server:_hosts' \
     '--smtp-server-port=[specify port to connect to SMTP server on]:smtp port:_ports' \
     '--smtp-server-option=[specify the outgoing SMTP server option to use]:SMPT server option' \
+    '--smtp-ssl-cert-path=[path to ca-certificates (directory or file)]:ca certificates path:_files' \
     '--smtp-user=[specify user to use for SMTP-AUTH]:smtp user:_users' \
     '--smtp-debug=[enable or disable debug output]:smtp debug:((0\:"disable" 1\:"enable"))' \
     '--cc-cmd=[specify command to generate Cc\: header with]:Cc\: command:_path_commands' \
@@ -4175,10 +4253,18 @@ _git-update-index () {
 
 (( $+functions[_git-update-ref] )) ||
 _git-update-ref () {
+  local z_opt
+
+  if (( words[(I)--stdin] )); then
+    z_opt='-z[values are separated with NUL character when reading from stdin]'
+  fi
+
   _arguments -w -S -s \
     '-m[update reflog for specified name with specified reason]:reason for update' \
     '(:)-d[delete given reference after verifying its value]:symbolic reference:__git_revisions:old reference:__git_revisions' \
-    '--no-deref[overwrite ref itself, not what it points to]' \
+    '(-d --no-deref)--stdin[reads instructions from standard input]' \
+    $z_opt \
+    '(-d -z --stdin)--no-deref[overwrite ref itself, not what it points to]' \
     ':symbolic reference:__git_revisions' \
     ':new reference:__git_revisions' \
     '::old reference:__git_revisions'
@@ -4386,6 +4472,7 @@ _git-merge-base () {
     '--octopus[compute best common ancestors of all supplied commits]' \
     '--is-ancestor[tell if A is ancestor of B (by exit status)]' \
     '(-)--independent[display minimal subset of supplied commits with same ancestors]' \
+    '--fork-point[find the point at which B forked from ref A (uses reflog)]' \
     ': :__git_commits' \
     '*: :__git_commits'
 }
@@ -4454,9 +4541,9 @@ _git-show-index () {
 _git-show-ref () {
   _arguments -S \
     - list \
-      '(-h --head)'{-h,--head}'[show HEAD reference]' \
+      '(-h --head)'{-h,--head}'[show the HEAD reference, even if it would normally be filtered out]' \
       '--tags[show only refs/tags]' \
-      '--heads[show only HEAD and refs under refs/heads]' \
+      '--heads[show only refs/heads]' \
       '(-d --dereference)'{-d,--dereference}'[dereference tags into object IDs as well]' \
       '(-s --hash)'{-s+,--hash=-}'[only show the SHA-1 hash, not the reference name]:: :__git_guard_number length' \
       '--verify[enable stricter reference checking]' \
@@ -4695,6 +4782,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_opt \
     '(-)--[interpret preceding arguments as attributes and following arguments as path names]' \
     '*:: :->attribute-or-file' && ret=0
@@ -5974,7 +6062,7 @@ __git_setup_diff_options () {
     '--find-copies-harder[try harder to find copies]'
     '(-D --irreversible-delete)'{-D,--irreversible-delete}'[omit the preimage for deletes]'
     '-l-[limit number of rename/copy targets to run]: :__git_guard_number'
-    '--diff-filter=-[select certain kinds of files for diff]: :_guard "[ACDMRTUXB*]#" kinds'
+    '--diff-filter=-[select certain kinds of files for diff]: :_guard "[AaCcDdMmRrTtUuXxBb*]#" kinds'
     '-S-[look for differences that add or remove the given string]:string'
     '-G-[look for differences whose added or removed line matches the given regex]:pattern'
     '--pickaxe-all[when -S finds a change, show all changes in that changeset]'
@@ -6069,7 +6157,10 @@ __git_setup_revision_options () {
     '--tags=[-show all commits from refs/tags]::pattern'
     '--remotes=[-show all commits from refs/remotes]::pattern'
     '--glob=[show all commits from refs matching glob]:pattern'
-    '--stdin[read commit objects from standard input]'
+    '--exclude=[do not include refs matching glob]:pattern'
+    '--exclude=[do not include refs matching glob]:pattern'
+    '--ignore-missing[ignore invalid object an ref names on command line]'
+    '--bisect[pretend as if refs/bisect/bad --not refs/bisect/good-* was given on command line]'
     '(-g --walk-reflogs --reverse)'{-g,--walk-reflogs}'[walk reflog entries from most recent to oldest]'
     '--grep-reflog=[limit commits to ones whose reflog message matches the given pattern (with -g, --walk-reflogs)]:pattern'
     '--merge[after a failed merge, show refs that touch files having a conflict]'
@@ -6279,15 +6370,22 @@ __git_browsers () {
   builtinbrowsers=(
     firefox
     iceweasel
+    seamonkey
+    iceape
     google-chrome
+    chrome
     chromium
     konquerer
+    opera
     w3m
+    elinks
     links
     lynx
     dillo
     open
-    start)
+    start
+    cygstart
+    xdg-open)
 
   _tags user-browsers builtin-browsers
 
@@ -6486,6 +6584,7 @@ _git() {
     _arguments -C \
       '(- :)--version[display version information]' \
       '(- :)--help[display help message]' \
+      '-C[run as if git was started in given path]: :_directories' \
       '-c[pass configuration parameter to command]:parameter' \
       '--exec-path=-[path containing core git-programs]:: :_directories' \
       '(: -)--man-path[print the manpath for the man pages for this version of Git and exit]' \
-- 
1.9.0.1.g7244ca4


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

* Re: [PATCH 2/4] _git: diff: refactor and fix wrong completions
  2014-02-17  4:00 ` [PATCH 2/4] _git: diff: refactor and fix wrong completions m0viefreak
@ 2014-02-18 11:24   ` Frank Terbeck
  0 siblings, 0 replies; 6+ messages in thread
From: Frank Terbeck @ 2014-02-18 11:24 UTC (permalink / raw)
  To: m0viefreak; +Cc: zsh-workers

Hey!

m0viefreak wrote:
[...]
> +      # If "--" is part of $opt_args, this means it was specified before any $words arguments. This means that no heads are specified in front, so we need to complete *changed* files only.
[...]

Thanks! I pushed all those, except that I broke the above comment into
multiple shorter lines.


Regards, Frank


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

end of thread, other threads:[~2014-02-18 11:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-17  4:00 [PATCH 0/4] _git: bugfixes, improvements and updates m0viefreak
2014-02-17  4:00 ` [PATCH 1/4] _git: fix __git_committish_range_{first,last} and __git_is_committish_range m0viefreak
2014-02-17  4:00 ` [PATCH 2/4] _git: diff: refactor and fix wrong completions m0viefreak
2014-02-18 11:24   ` Frank Terbeck
2014-02-17  4:00 ` [PATCH 3/4] _git: fix __git_submodules to only use the actual name of the submodule m0viefreak
2014-02-17  4:00 ` [PATCH 4/4] _git: completion updates up to latest git v1.9.0 m0viefreak

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