1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-07-12 17:11:25 +02:00
Commit graph

446 commits

Author SHA1 Message Date
Oliver Kiddle
8c57505314 43698: update options for git 2.19.1 2018-10-17 17:56:36 +02:00
Daniel Shahaf
b44be21525 43443: _git: When completing worktrees, show the ref and hash of each worktree. 2018-09-12 15:12:09 +00:00
Daniel Shahaf
7ae2be3a2f 43442: _git: Break out a helper function. 2018-09-12 15:12:07 +00:00
Oliver Kiddle
410c30a25b unposted: git describe's --long and --abbrev options are not mutually exclusive 2018-08-31 23:17:28 +02:00
Oliver Kiddle
36ac12d0b6 43359: further review of git remote set-url completion 2018-08-31 23:10:36 +02:00
pseyfert
e754b18ca7 42810: git remote set-url completion 2018-08-31 22:58:52 +02:00
Marc Cornellà
99fd8c0fe9 unposted (PR ): __git_files: fix double quotation of star
This fixes the double quote introduced by aa160fc8, so that the end result of
the parameter expansion is $pref followed by \* (a quoted star), meaning
`git ls-files` gets a literal star, not an expanded list of matching files, as
was intended in commit cc7437bf.

Fixes completion of `git add ../<TAB>`.
2018-08-12 19:37:47 +00:00
Oliver Kiddle
afd008d96b 43073: various completion option updates 2018-06-21 13:28:24 +02:00
Tim Smith
25e9590e09 43006: complete modified files after git stash -- 2018-06-18 09:23:27 +02:00
Oliver Kiddle
4dddf3aa6e users/23484: be consistent on matcher specs for git branches to fix issue with partial matching 2018-06-18 09:19:26 +02:00
Peter Stephenson
fa441fa20e 42752: enhance git external alias completion
If alias expands to !cmd-name, complete as a normal command
line after cmd-name.
2018-05-08 17:13:12 +01:00
Oliver Kiddle
39f58eb318 42659: various completion option updates 2018-04-16 17:02:56 +02:00
Oliver Kiddle
4977ec1398 42491 based on 42000 (Andrei Shevchuk): factor ssh host completion for use for mosh and git 2018-03-24 00:09:12 +01:00
Daniel Hahler
1142e2dedb 42364: _git: fix __git_ignore_line to ignore the current word
Before this patch "git branch -d master<tab>" would result in
"no matches found", while "master" itself should get completed here.

The "(bQ)" (added in 527badc23, via 38129?!) does not seem to be necessary
anymore: with files "f\[a-z\]o" and "foo", "git add f[a-z]o <tab>"
offers "f\[a-z\]o", but not "foo".
2018-02-22 23:41:13 +01:00
Daniel Hahler
2bf952b102 42324: _git: handle mutually exclusive options
Currently `git show --stat -p` is not considered a valid completion and
prevents further completions like `--no-abbrev`.

It is a valid use case however to use `--stat` with `-p` (and there is a
synonym `--patch-with-stat` for it even).

This patch changes `__git_setup_diff_options` to only handle mutually
exclusive arguments reported by Git (as a fatal error) in a special way.
2018-02-12 10:12:22 +01:00
Christian Hesse
dd8e55c46b 42333: git 2.16.0 no longer accepts an empty string as a pathspec element so replace empty strings with a dot 2018-02-08 00:49:46 +01:00
Daniel Hahler
2870302afa 42323: _git: move "local" statement out of loop
Fixup for 99cf61fd4.
2018-01-24 21:55:27 +01:00
Oliver Kiddle
47430bcd7c 42317: completion option updates for commands that have had recent updates 2018-01-23 11:03:00 +01:00
Eric Cook
99cf61fd42 42171: prevent parameters of various parameters from becoming global 2018-01-02 14:38:03 -05:00
Daniel Shahaf
a254c1815a 42138: _git-revert: Complete recent commits first. 2017-12-20 04:13:39 +00:00
Oliver Kiddle
09939216d4 42019: update options in git completion to 2.15
also improve format completion for git tag and for-each-ref
2017-11-13 21:47:29 +01:00
Oliver Kiddle
85e56b5a48 41957: update git completion for git 2.14.3 2017-10-29 00:07:22 +02:00
Noah Pendleton
63271a4b93 41808: _git-cherry-pick: Typo fixes 2017-10-04 22:07:23 +00:00
Oliver Kiddle
f80fe2dfe9 41552: complete only branches after git worktree add --detach
the --detach is superfluous for other commits
2017-08-16 23:41:09 +02:00
Oliver Kiddle
943a061ea5 41493: fix to not print hash into terminal and update options for git 2.14 2017-08-06 00:28:22 +02:00
Daniel Shahaf
17a6eb655d 41475: _git: Complete files after 'reset' when there are no commits, when the 'verbose' style is set. 2017-08-02 14:09:57 +00:00
Daniel Shahaf
562482a495 unposted: _git: Fix style lookup for 'max-verbose'. 2017-07-31 00:52:49 +00:00
Fabian Klötzl
4a63a1793a 41414: fix for commas used in exclusion lists
also missing escape for _gcc and --no-index option for git diff
2017-07-14 12:07:49 +02:00
Oliver Kiddle
76a4a5ed3c 41419: update for git 2.13.2 2017-07-14 11:59:31 +02:00
Peter Stephenson
c5783576e8 41339: Unquote treeish argument for git checkout completion 2017-06-22 10:05:07 +01:00
Daniel Hahler
4fa7c6aecc 40943: __git_recent_commits: prefer recent commit objects
Without this "commit to be amended" shows up before "recent commit object
name" with `git commit --fixup`, but the recent commit objects are the
most useful here.
2017-04-23 22:27:38 +02:00
Daniel Shahaf
e869952200 40818: _git-checkout: When completing local heads, prefer recently-checked-out ones. (after 38592) 2017-03-14 11:14:14 +00:00
Daniel Shahaf
46233c4020 40817: __git_recent_branches: Retrieve less data, but faster.
By replacing the --grep-reflog=needle argument with a ${(M)...:#needle} filter,
we retrieve less data from the reflog, and consequently run (on my test cases)
16% to 40% faster.  The trade-off is that we retrieve less data: instead of
retrieving the 1000 most recent 'checkout' operations, we retrieve the most
recent 1000 operations, which would include fewer than 1000 checkout operations.

Also change [[:xdigit:]] to [0-9a-f] since it's faster, however, the absolute
gain from this is minor compared to the cost of 'git reflog'.
2017-03-14 11:14:13 +00:00
Fabian Klotzl
7276d04934 40808: fix typos where (x,y) should have been (x y) in _arguments syntax 2017-03-09 20:29:27 -08:00
Oliver Kiddle
76a033e2cc 40715: update completion of git options for git 2.12.0 2017-03-04 00:37:04 +01:00
Daniel Shahaf
ec1bdab023 40494: _git: Use slashes matchspec for references (as already used for branch names). 2017-02-07 08:43:31 +00:00
Daniel Shahaf
3afd12ae97 40493/0002: _git-checkout: Reorder default completions.
The unprefixed name of a remote branch is used to create a new local
remote-tracking branch; that is presumed to be a rarer operation than
either switching among local branches or reverting to the index version
of a modified file.

Between the remaining two, put modified files before tree-ishes because
there are generally few of the former and many of the latter.
2017-02-07 08:43:31 +00:00
Daniel Shahaf
4da5c23dce 40493/0001: _git-checkout: No functional change.
This makes the next diff smaller.
2017-02-07 08:43:31 +00:00
Oliver Kiddle
f65283e1ad 40055: update git completion for git 2.11.0 2016-12-01 21:50:47 +01:00
Eitan Adler
110ffae9fe 40035: Cosmetic fixes for comments and documentation.
Mostly fixes to doubled words.
2016-11-29 17:13:52 +00:00
Daniel Shahaf
a74294edbe unposted: _git-config: Fix user.email completion to complete only bare email addresses. 2016-11-29 06:41:21 +00:00
Daniel Shahaf
df8d219da3 39916 + 39930 + tweak: _git: Complete options and values for -c.
The "$@" in the option-names call is added in order to propagate the new (-S =) arguments.

This bifurcates _git-config() in order to provide completion for

    % git -c <TAB>
    % git -c foo=<TAB>
2016-11-18 02:11:05 +00:00
Daniel Shahaf
297471cf77 39921: __git_recent_branches: Remove erroneous parsing of partial ref names as tags.
In the reflog, partial ref names in the "from" field always represent names of
heads.  (That is not true for the "to" field.)  The parsing of tag names was
added in commit 39102 (317c96b64f) for equivalence
with the then-previous implementation which used `git log $partial_ref_name`.
The equivalence was correct, however, the then-previous implementation was not,
since it would consider $partial_ref_name as a refs/tags/ name if a refs/heads/
name did not exist.
2016-11-17 15:32:05 +00:00
Daniel Shahaf
d7b57cc957 39922: __git_recent_branches: Fix an 'assertion' failure when two branches (refs) point to the same commit. 2016-11-17 15:32:04 +00:00
Daniel Hahler
d90775fc29 39822: _git: remove "-A '-*'" with _arguments for some commands
With e.g. `git rebase origin/master` you can have options like
`--no-autosquash` after the argument.

I have tried the commands where this patch removes `-A`.
Commands like `git fetch-pack` that do not support options after
arguments are left unchanged.
2016-11-03 16:41:42 +01:00
Daniel Shahaf
dd8b756610 _git-cherry-pick: Complete argv[2] et seq. 2016-10-29 03:03:28 +00:00
Daniel Shahaf
7ad0001183 39479 + 39481 minus _path_files hunk (see 39489): Completion: audit 'compset -P' calls to use shortest match where applicable, plus random drive-by tweaks.
Found by grepping for patterns that can match needles of various lengths:

    :grep 'compset -[PS].*[\#^*()\|<>?~\]' Completion/
2016-10-07 13:56:31 +00:00
Oliver Kiddle
13d0b278be 39514: pass on --git-dir when calling git to get completion matches 2016-09-30 09:57:50 +02:00
Daniel Shahaf
ec0c788709 unposted: _git: Permit multiple -c options. 2016-09-14 05:27:26 +00:00
Oliver Kiddle
48c20d74a7 39165: update options to correspond to latest versions of software in various functions 2016-09-03 12:31:22 +02:00
Daniel Shahaf
c2592b4f72 39122: __git_recent_branches: Silence warning on an edge case.
(The warning was correct; there is no functional change, though.)
2016-08-31 02:23:39 +00:00
Daniel Shahaf
317c96b64f 39102: __git_recent_branches: Optimise.
This improves performance from 0.6s to 0.04s (+93%) on one of Daniel Hahler's repositories.
2016-08-25 18:12:41 +00:00
Daniel Shahaf
4d995160e4 39094: _git-config: When an option is unknown, complete its value to the set value. 2016-08-24 21:15:00 +00:00
Oliver Kiddle
18aa25c75d unposted (c.f. Mikael: 39078): fix for git blame terms 2016-08-22 11:54:04 +02:00
Daniel Shahaf
c8b228b1ea unposted: _git-config: sendemail.smtpserver: Correct tags. 2016-08-22 03:38:12 +00:00
Oliver Kiddle
31dc8b52b5 39072: minor tweaks 2016-08-19 19:11:07 +02:00
Daniel Hahler
ef64b6a929 39040: Completion/…/_git: fix missing backslashes in 39036 2016-08-15 12:06:58 +02:00
Oliver Kiddle
30aafc0b68 39036: update git completion for new options up to git 2.9.2 2016-08-13 01:37:57 +02:00
Daniel Shahaf
faa163cd5f 38964: _git-config: Complete option names present in the config file.
This patch lets
.
    git config x.y.z value
    git config <TAB>
.
complete 'x.y.z', even if x.y.z isn't hardcoded into _git-config.
2016-08-01 08:01:27 +00:00
Daniel Shahaf
b056d8c909 38963: _git-config: Run gettable-options earlier and in all codepaths.
No change to completions; this is preparation for the next commit.
2016-08-01 08:01:26 +00:00
Daniel Shahaf
0782e0a0a6 38961: _git-config: No functional change: rename $git_options_static to $git_options in preparation for the after-next commit. 2016-08-01 08:01:24 +00:00
Daniel Shahaf
9ef02744dd unposted: _git: Clean up superfluous and missing backslashes. 2016-07-31 16:21:33 +00:00
Daniel Shahaf
774f654e36 38962: _git-config: Document more line noise. 2016-07-31 16:21:28 +00:00
Daniel Shahaf
8e06a6a28a unposted (after 38939): _git-rebase: Unbreak. 2016-07-27 14:04:40 +00:00
Oliver Kiddle
4f5cc54560 38939: add missing git options
In particular those for GPG signing a push
2016-07-25 00:06:57 +02:00
Daniel Shahaf
3afaebd913 unposted: _git-grep: Stop leaking the parameter $i. 2016-07-23 18:02:29 +00:00
Daniel Shahaf
db9f0d3b3e unposted (cf. users/21737):: _git-subtree: Record technical debt in comment. 2016-07-17 14:55:35 +00:00
Daniel Shahaf
d09cb7e979 users/21750 (after users/21551): _git-subtree: Tweak -m,-P completions 2016-07-17 14:53:12 +00:00
Jordan Klassen
92d516cfa7 users/21551 (tweaked per users/21560): new git subtree completion 2016-07-05 23:29:40 +02:00
Daniel Shahaf
3a034838b4 38760: _git-config: Stop trying to execute the empty string command name upon completing values for an unknown option.
For example:

% git config x.y.z <TAB>
+_git-config:834> case x.y.z (alias.*)
+_git-config:834> case x.y.z (remotes.*)
+_git-config:860> local z=$'\C-@'
+_git-config:861> declare -a parts
+_git-config:862> parts=( '' )
+_git-config:863> ((  1 < 2  ))
+_git-config:863> [[ x.y.z == [^.]##.*.[^.]## ]]
+_git-config:864> parts=( '' )
+_git-config:866> ((  1 > 0  ))
+_git-config:867> case  (-\>*)
+_git-config:867> case  (*)
+_git-config:1197> declare -a action
+_git-config:1198> _description values expl ''
+_git-config:1199> eval 'action=()'
+(eval):1> action=( )
+_git-config:1200> '' -J values
_git-config:1200: permission denied:
+_git-config:1206> return ret
2016-06-27 00:21:02 +00:00
Daniel Shahaf
3bd8abc40b unposted: _git-config: Document some line noise. 2016-06-25 16:33:33 +00:00
Daniel Shahaf
59bf331d27 unposted: _git-config: Fix syntax error in 'tag.sort' completion. 2016-06-25 16:32:34 +00:00
Daniel Shahaf
aa160fc8e9 38651: _git: Escape parameter arguments to _call_program.
Fixes 'git cat-file blob HEAD^:<TAB>' and a few other cases.
2016-06-13 08:53:17 +00:00
Daniel Shahaf
ec7088296b 38665: _git: config option completion: Quote properly. 2016-06-13 08:53:14 +00:00
Daniel Shahaf
0516736eae 38624: _git: Optimize the last commit's __git_recent_branches__names as suggested by Matthew. 2016-06-07 22:53:51 +00:00
Daniel Shahaf
6e834587eb 38592 (plus tweak): _git: New recent branches completion, unused. (Joint with Nils Luxton) 2016-06-07 22:53:46 +00:00
Daniel Shahaf
713eaa055d 38576: _git: Also detect _git-${thirdparty} functions in $fpath that are symlinks. 2016-06-03 02:21:54 +00:00
Russell Currey
058d957ce5 38393: _git: Fix typo in completion of '--minimal'
Signed-off-by: Russell Currey <ruscur@russell.cc>
2016-05-03 11:26:54 +00:00
Daniel Shahaf
276a690a2e _git: Complete fetchy refspecs correctly. 2016-05-01 01:52:29 +00:00
Daniel Shahaf
fe21e49a6d _git: Bifurcate __git_ref_specs.
No functional change, except for completion of 'git bundle' and 'git config
branch.*.merge'; this is a required groundwork for future patches.
2016-05-01 01:52:29 +00:00
Daniel Shahaf
c57d8dfcaa _git: Fix an apparent typo in __git_heads().
I couldn't reproduce different behaviour with and without this patch, although
the called command's output differs.
2016-05-01 01:52:28 +00:00
Daniel Shahaf
3e26848ef4 _git: Offer alternatives properly. 2016-05-01 01:52:28 +00:00
Daniel Shahaf
2979122d2d _git-bundle: Complete required file argument to 'git bundle' correctly. 2016-05-01 01:52:28 +00:00
Daniel Shahaf
442d702bbc 38316: _git-rebase: Complete any committish for the second argument 2016-04-23 21:28:21 +00:00
Daniel Shahaf
4df62e32fc 38255: _git: Fix argument pastedness.
Found by searching for /-\w\>.*:/.

This covers short options only, from the top of file through _git-tag().
2016-04-09 03:35:14 +00:00
Daniel Shahaf
9f70404714 38182: _git: Invoke reflog completion from the 'complete commit objects' codepath.
The reflog will only be used if the user has typed as "@" by hand.
2016-03-21 16:12:15 +00:00
Daniel Shahaf
ce4c9eafc4 38181: _git reflog: Complete '@{N}' instead of 'HEAD@{N}'.
The «HEAD@{...}» syntax is no longer completed, since it's not easily possible
to support both syntaxes (workers/34768).
2016-03-21 16:12:13 +00:00
Daniel Shahaf
67136df0bf 38180: _git: Improve reflog completion.
Currently, only used by «git reflog delete <TAB>».
2016-03-21 16:12:10 +00:00
m0viefreak
a1f45b3346 38151: _git: fix tag name of remote branches 2016-03-15 00:07:18 +00:00
m0viefreak
666a7f5845 38148: _git: reflog: complete references next to commands
'git reflog show' is the default subcommand, so

  git reflog <tab>

should complete subcommands and references.
2016-03-15 00:07:15 +00:00
Daniel Shahaf
527badc237 38129: _git: Fix __git_ignore_line's treatment of shell and pattern metacaracters.
Builds upon a patch by Jun T.

Also upgrade/fix __git_pattern_escape.
2016-03-11 22:19:04 +00:00
Daniel Shahaf
98fcdb0861 38128: _git: Fix completion of diffs against the index when treeish isn't shell-safe
This affects 'git diff --cached -- <TAB>' and 'git reset $treeish <TAB>'.
2016-03-10 23:18:36 +00:00
Daniel Shahaf
be41c522f2 38123 (after 38074): _git reset $treeish: complete only staged files 2016-03-10 23:18:15 +00:00
Daniel Shahaf
33bd9136d6 38120: _git: Document the internal helper function __git_ignore_line. 2016-03-09 14:08:49 +00:00
Jun-ichi Takimoto
983060d5d1 38074: _git reset HEAD: complete only staged files 2016-03-08 21:21:44 +09:00
Daniel Shahaf
8a59aed696 37924: Completion: _git: Complete files for 'check-ignore'
Also, don't leak the parameter 'ret'; the leak was theoretical because
the caller immediately wrote to that parameter.
2016-02-09 03:41:46 +00:00
Daniel Shahaf
295133d741 37703: Completion: git: Also complete sendmail commands for send-email's configuration. (after 37666) 2016-01-23 23:50:04 +00:00
Daniel Shahaf
3eb4d9c2e2 37666: Completion: git: 'send-email --smtp-server=' takes absolute path to sendmail. 2016-01-20 07:49:30 +00:00
Daniel Shahaf
c6fc6f80cd 37665: Completion: New helper _absolute_command_paths. 2016-01-20 07:49:29 +00:00
Daniel Shahaf
e14540ac02 37150: _git: Autocomplete .. for commit ranges
This patch makes three changes:

- Enable 'git diff o/m<TAB>' to complete to 'origin/master..' with the
  ".." being autoremovable.

  This is implemented by the first hunk.  That hunk is a functional
  subset of Oliver's users/20705, however, the latter hasn't been
  committed.

- Make typing "^" remove the "..", in light of the syntax "foo^..bar".

- Make typing "." _not_ remove the ".." but simply append it, since
  "foo...bar" is a valid and useful syntax.
2015-12-05 10:15:40 +00:00