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.
Before this patch, 'git push $remote :<TAB>' completed branch names (as though
by `git branch -a`), instead of completing remote branch names sans the
${remote}/ prefix.
The uniquifiers 'HEAD~$n' were incorrect when a recent commit was the second
parent of a merge commit. Detect that case and print something correct
instead.
Offer the "this alternative is still valid, but I don't know to offer
completions for it" for hash completion but not for recent object completion;
the former is protected by a _guard and the latter incorrectly appeared also in
cases such as 'git log a/b<TAB>' which were not the start of a gitrevisions(7)
expression.
It is defined at the beginning of the function already, and results in
the output of `expl=''` when completing after `git config
branch.local.pushremote ` etc.
This makes `branch_arg` empty by default, to be used only for
__git_remote_branch_names.
`branches::__git_revisions` was used here, but that's the same as
tree_ish_arg='tree-ishs::__git_tree_ishs' - both call __git_commits.
Only tree_ish_arg will call __git-commits now.
Without this, `ret` will be set to 1 with `git diff --ex<tab>` and
result in duplicate entries:
% git diff --ex<tab>
-- option --
--exit-code -- report exit code 1 if differences, 0 otherwise
--exit-code -- report exit code 1 if differences, 0 otherwise
--ext-diff -- allow external diff helper to be executed
--ext-diff -- allow external diff helper to be executed
--no-ext-diff -- disallow external diff helper to be executed
-- recent commit object name --
With using `_guard` there like it's been done, the completion could not
be selected, probably because of the call to `_message` therein.
This changes it to use only the logic/check from `_guard` that we want
here.
Remove "-2" for _describe in __git_recent_commits.
This fixes the duplicate entries issue, because __git_recent_commits
gets called twice for _git-checkout (for __git_revisions and
__git_tree_ishs):
1. __git_commit_objects_prefer_recent _alternative __git_commits
__git_revisions _alternative _git-checkout
2. __git_commit_objects_prefer_recent _alternative __git_commits
__git_tree_ishs _alternative _git-checkout
$pipestatus for `: foo` is 0 always.
Without this, "git checkout" in a non-git directory would complete " ",
but not result in a note/error about not being in a git dir.
Allows 'git checkout o/m<TAB>' to complete 'origin/master'.
Moreover, '/x<TAB>' would complete 'foo/bar/xyzzy/baz', since the matchspec
uses not '*' but '**'.
This adds the "HEAD~15" gitrevisions(7) identifier of the commit to the
description, which also uniquifies, isn't redundant, and may be easier
to type.
Ref: zsh-workers/34820 (http://www.zsh.org/mla/workers/2015/msg00744.html)
Also, `--all` and `--reflog` is used to get all commits.
It adds the _guard in front, so only non-empty values will come here.
Also, __git_commit_objects_prefer_recent will only call it, if there are
no matching recent commits.
It is now possible to use the tag-order style to stagger the overwhelming
'git <TAB>' subcommand listing. For example:
zstyle ':completion::complete:git:argument-1:' tag-order \
main-porcelain-commands user-commands third-party-commands \
ancillary-manipulator-commands ancillary-interrogator-commands \
plumbing-manipulator-commands plumbing-interrogator-commands \
aliases
- 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
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.
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.
- 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.
Shell functions are strictly ASCII for maximum portability.
Other files within the distribution may contain UTF-8 characters.
Exception for test files: where they need single character input
with the top bit set, ISO-8859-X is used (X doesn't matter as
we don't need the Euro).
commit: '--null' is documented
relink: '-h,--help' are never documented for subcommands but always exist
verify-tag: '-v,--verbose' are documented with updated description
diff: '--cumulative' is deprecated -> remove
While limiting the completion to __git_changed-in-index_files
makes perfect sense for "git diff", it is wrong to use for
"git rm", because it prevents it from completing files present in
HEAD. Giving --cached to git rm is supposed to
"just remove it from the index, keep the working tree copy"
and is in no way related to the file needing to be
modified in the index in the first place.
diff options:
--cumulative is deprecated --> remove
-G / -S: reword -S to emphase the difference to -G
revision options:
--abbrev: reword, to emphase the --abbrev-commit requirement
this is used in git 1.8's
git checkout <branch>
as a shorthand for
git checkout -b <branch> --track <remote>/<branch>
in case <branch> exists on exactly one remote and is not a local branch