1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

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.
This commit is contained in:
Daniel Shahaf 2015-11-18 23:15:41 +00:00
parent 6a3de994af
commit e14540ac02
2 changed files with 6 additions and 3 deletions

View file

@ -1,5 +1,8 @@
2015-12-05 Daniel Shahaf <d.s@daniel.shahaf.name>
* 37150: Completion/Unix/Command/_git: _git: Autocomplete .. for
commit ranges
* 36957: Completion/Unix/Command/_git: _git: Apply matchspecs to
filename completion such as 'git log f/b<TAB>' → 'foo/bar.txt's

View file

@ -5623,8 +5623,8 @@ __git_commits () {
(( $+functions[__git_heads] )) ||
__git_heads () {
__git_heads_local
__git_heads_remote
__git_heads_local "$@"
__git_heads_remote "$@"
}
(( $+functions[__git_heads_local] )) ||
@ -5815,7 +5815,7 @@ __git_commit_ranges () {
if [[ ${PREFIX} = (#b)((\\|)\^)* ]]; then
compset -p ${#match[1]}
else
suf=( -S .. -r '.@~ ^:\t\n\-' )
suf=( -S .. -r '@~ \^:\t\n\-' )
fi
fi
expl=( $* $suf )