summaryrefslogtreecommitdiff
path: root/contrib/completion
AgeCommit message (Collapse)Author
2010-06-30Merge branch 'tr/rev-list-count'Junio C Hamano
* tr/rev-list-count: bash completion: Support "divergence from upstream" messages in __git_ps1 rev-list: introduce --count option Conflicts: contrib/completion/git-completion.bash
2010-06-30Merge branch 'as/maint-completion-set-u-fix'Junio C Hamano
* as/maint-completion-set-u-fix: bash-completion: Fix __git_ps1 to work with "set -u"
2010-06-24bash completion: Support "divergence from upstream" messages in __git_ps1Andrew Sayers
Add a notification in the command prompt specifying whether (and optionally how far) your branch has diverged from its upstream. This is especially helpful in small teams that very frequently (forget to) push to each other. Support git-svn upstream detection as a special case, as migrators from centralised version control systems are especially likely to forget to push. Support for other types of upstream than SVN should be easy to add if anyone is so inclined. Signed-off-by: Andrew Sayers <andrew-git@pileofstuff.org> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-22Merge branch 'sb/format-patch-signature'Junio C Hamano
* sb/format-patch-signature: completion: Add --signature and format.signature format-patch: Add a signature option (--signature)
2010-06-21Merge branch 'em/checkout-orphan'Junio C Hamano
* em/checkout-orphan: log_ref_setup: don't return stack-allocated array bash completion: add --orphan to 'git checkout' t3200: test -l with core.logAllRefUpdates options checkout --orphan: respect -l option always refs: split log_ref_write logic into log_ref_setup Documentation: alter checkout --orphan description
2010-06-18bash-completion: Fix __git_ps1 to work with "set -u"Andrew Sayers
Define several variables in __git_ps1 to avoid errors under "set -u" semantics. __git_ps1 seems to have been missed when the rest of the file was fixed in 25a31f8. Signed-off-by: Andrew Sayers <andrew-git@pileofstuff.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-16completion: Add --signature and format.signatureStephen Boyd
Cc: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-03bash completion: add --orphan to 'git checkout'Erick Mattos
Update git-completion.bash with new --orphan option to 'git checkout'. Signed-off-by: Erick Mattos <erick.mattos@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-28completion: --set-upstream option for git-branchMichael J Gruber
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-06Merge branch 'sg/bash-completion'Junio C Hamano
* sg/bash-completion: bash: completion for gitk aliases bash: support user-supplied completion scripts for aliases bash: support user-supplied completion scripts for user's git commands bash: improve aliased command recognition
2010-03-17bash: complete *_HEAD refs if presentIan Ward Comfort
We already complete HEAD, of course, and might as well complete the other common refs mentioned in the rev-parse man page: FETCH_HEAD, ORIG_HEAD, and MERGE_HEAD. Signed-off-by: Ian Ward Comfort <icomfort@stanford.edu> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-24bash: completion for gitk aliasesSZEDER Gábor
gitk aliases either start with "!gitk", or look something like "!sh -c FOO=bar gitk", IOW they contain the "gitk" word. With this patch the completion script will recognize these cases and will offer gitk's options. Just like the earlier change improving on aliased command recognition, this change can also be fooled easily by some complex aliases, but users of such aliases could remedy it with custom completion functions. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-24bash: support user-supplied completion scripts for aliasesSZEDER Gábor
Shell command aliases can get rather complex, and the completion script can not always determine correctly the git command invoked by such an alias. For such cases users might want to provide custom completion scripts the same way like for their custom commands made possible by the previous patch. The current completion script does not allow this, because if it encounters an alias, then it will unconditionally perform completion for the aliased git command (in case it can determine the aliased git command, of course). With this patch the completion script will first search for a completion function for the command given on the command line, be it a git command, a custom git command of the user, or an alias, and invoke that function to perform the completion. This has no effect on git commands, because they can not be aliased anyway. If it is an alias and there is a completion function for that alias (e.g. _git_foo() for the alias 'foo'), then it will be invoked to perform completion, allowing users to provide custom completion functions for aliases. If such a completion function can not be found, only then will the completion script check whether the command given on the command line is an alias or not, and proceed as usual (i.e. find out the aliased git command and provide completion for it). Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-24bash: support user-supplied completion scripts for user's git commandsSZEDER Gábor
The bash completion script already provides support to complete aliases, options and refs for aliases (if the alias can be traced back to a supported git command by __git_aliased_command()), and the user's custom git commands, but it does not support the options of the user's custom git commands (of course; how could it know about the options of a custom git command?). Users of such custom git commands could extend git's bash completion script by writing functions to support their commands, but they might have issues with it: they might not have the rights to modify a system-wide git completion script, and they will need to track and merge upstream changes in the future. This patch addresses this by providing means for users to supply custom completion scriplets for their custom git commands without modifying the main git bash completion script. Instead of having a huge hard-coded list of command-completion function pairs (in _git()), the completion script will figure out which completion function to call based on the command's name. That is, when completing the options of 'git foo', the main completion script will check whether the function '_git_foo' is declared, and if declared, it will invoke that function to perform the completion. If such a function is not declared, it will fall back to complete file names. So, users will only need to provide this '_git_foo' completion function in a separate file, source that file, and it will be used the next time they press TAB after 'git foo '. There are two git commands (stage and whatchanged), for which the completion functions of other commands were used, therefore they got their own completion function. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-24bash: improve aliased command recognitionSZEDER Gábor
To support completion for aliases, the completion script tries to figure out which git command is invoked by an alias. Its implementation in __git_aliased_command() is rather straightforward: it returns the first word from the alias. For simple aliases starting with the git command (e.g. alias.last = cat-file commit HEAD) this gives the right results. Unfortunately, it does not work with shell command aliases, which can get rather complex, as illustrated by one of Junio's aliases: [alias] lgm = "!sh -c 'GIT_NOTES_REF=refs/notes/amlog git log \"$@\" || :' -" In this case the current implementation returns "!sh" as the aliased git command, which is obviosly wrong. The full parsing of a shell command alias like that in the completion code is clearly unfeasible. However, we can easily improve on aliased command recognition by eleminating stuff that is definitely not a git command: shell commands (anything starting with '!'), command line options (anything starting with '-'), environment variables (anything with a '=' in it), and git itself. This way the above alias would be handled correctly, and the completion script would correctly recognize "log" as the aliased git command. Of course, this solution is not perfect either, and could be fooled easily. It's not hard to construct an alias, in which a word does not match any of these filter patterns, but is still not a git command (e.g. by setting an environment variable to a value which contains spaces). It may even return false positives, when the output of a git command is piped into an other git command, and the second gets the command line options via $@, but options for the first one are offered. However, the following patches will enable the user to supply custom completion scripts for aliases, which can be used to remedy these problematic cases. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-12bash: support 'git am's new '--continue' optionSZEDER Gábor
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-06bash: support the --autosquash option for rebaseBjörn Gustavsson
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-28Merge branch 'maint'Junio C Hamano
* maint: bash: don't offer remote transport helpers as subcommands
2010-01-28bash: support 'git notes' and its subcommandsSZEDER Gábor
... and it will offer refs unless after -m or -F, because these two options require a non-ref argument. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-28bash: don't offer remote transport helpers as subcommandsSZEDER Gábor
Since commits a2d725b7 (Use an external program to implement fetching with curl, 2009-08-05) and c9e388bb (Make the "traditionally-supported" URLs a special case, 2009-09-03) remote transport helpers like 'remote-ftp' and 'remote-curl' are offered by the completion script as available subcommands. Not good, since they are helpers, therefore should not be offered, so filter them out. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20Merge branch 'maint-1.6.5' into maintJunio C Hamano
* maint-1.6.5: Git 1.6.5.8 Fix mis-backport of t7002 bash completion: factor submodules into dirty state reset: unbreak hard resets with GIT_WORK_TREE Conflicts: Documentation/git.txt GIT-VERSION-GEN RelNotes
2010-01-10Merge branch 'tr/maint-1.6.5-bash-prompt-show-submodule-changes'Junio C Hamano
* tr/maint-1.6.5-bash-prompt-show-submodule-changes: bash completion: factor submodules into dirty state
2009-12-31bash completion: factor submodules into dirty stateThomas Rast
In the implementation of GIT_PS1_SHOWDIRTYSTATE in 738a94a (bash: offer to show (un)staged changes, 2009-02-03), I cut&pasted the git-diff invocations from dirty-worktree checks elsewhere, carrying along the --ignore-submodules option. As pointed out by Kevin Ballard, this doesn't really make sense: to the _user_, a changed submodule counts towards uncommitted changes. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-31bash completion: add space between branch name and status flagsShawn O. Pearce
Improve the readability of the bash prompt by adding a space between the branch name and the status flags (dirty, stash, untracked). While we are cleaning up this section of code, the two cases for formatting the prompt are identical except for the format string, so make them the same. Suggested-by: Roman Fietze <roman.fietze@telemotive.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-30Add completion for git-svn mkdirs,reset,and gcRobert Zeh
Signed-off-by: Robert Zeh <robert.a.zeh@gmail.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-12bash: Support new 'git fetch' optionsBjörn Gustavsson
Support the new options --all, --prune, and --dry-run for 'git fetch'. As the --multiple option was primarily introduced to enable 'git remote update' to be re-implemented in terms of 'git fetch' (16679e37) and is not likely to be used much from the command line, it does not seems worthwhile to complicate the code (to support completion of multiple remotes) to handle it. Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-06bash: update 'git commit' completionSZEDER Gábor
I just wanted to add the recently learnt '--reset-author' option, but then noticed that there are many more options missing. This patch adds support for all of 'git commit's options, except '--allow-empty', because it is primarily there for foreign scm interfaces. Furthermore, this patch also adds support for completing the arguments of those options that take a non-filename argument: valid modes are offered for '--cleanup' and '--untracked-files', while refs for '--reuse-message' and '--reedit-message', because these two take a commit as argument. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-23Merge branch 'jn/faster-completion-startup'Junio C Hamano
* jn/faster-completion-startup: Speed up bash completion loading
2009-11-18Speed up bash completion loadingJonathan Nieder
Since git is not used in each and every interactive xterm, it seems best to load completion support with cold caches and then load each needed thing lazily. This has most of the speed advantage of pre-generating everything at build time, without the complication of figuring out at build time what commands will be available at run time. On this slow laptop, this decreases the time to load git-completion.bash from about 500 ms to about 175 ms. Suggested-by: Kirill Smelkov <kirr@mns.spb.ru> Acked-by: Shawn O. Pearce <spearce@spearce.org> Cc: Stephen Boyd <bebarino@gmail.com> Cc: SZEDER Gábor <szeder@ira.uka.de> Cc: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-16Merge branch 'sc/difftool-p4merge'Junio C Hamano
* sc/difftool-p4merge: mergetool--lib: add p4merge as a pre-configured mergetool option
2009-11-14bash: add the merge option --ff-onlyBjörn Gustavsson
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-28mergetool--lib: add p4merge as a pre-configured mergetool optionScott Chacon
Add p4merge to the set of built-in diff/merge tools, and update bash completion and documentation. Signed-off-by: Scott Chacon <schacon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-28bash completion: difftool accepts the same options as diffMarkus Heidelberg
So complete refs, files after the double-dash and some diff options that make sense for difftool. Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-28bash: complete more options for 'git rebase'Björn Gustavsson
Complete all long options for 'git rebase' except --no-verify (probably used very seldom) and the long options corresponding to -v, -q, and -f. Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-12bash completion: complete refs for git-grepThomas Rast
Before the --, always attempt ref completion. This helps with entering the <treeish> arguments to git-grep. As a bonus, you can work around git-grep's current lack of --all by hitting M-*, ugly as the resulting command line may be. Strictly speaking, completing the regular expression argument (or option argument) makes no sense. However, we cannot prevent _all_ completion (it will fall back to filenames), so we dispense with any additional complication to detect whether the user still has to enter a regular expression. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-09bash: add support for 'git replace'Björn Gustavsson
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-09completion: fix alias listings with newlinesStephen Boyd
Aliases with newlines have been a problem since commit 56fc25f (Bash completion support for remotes in .git/config., 2006-11-05). The chance of the problem occurring has been slim at best, until commit 518ef8f (completion: Replace config --list with --get-regexp, 2009-09-11) removed the case statement introduced by commit 56fc25f. Before removing the case statement, most aliases with newlines would work unless they were specially crafted as follows [alias] foo = "log -1 --pretty='format:%s\nalias.error=broken'" After removing the case statement, a more benign alias like [alias] whowhat = "log -1 --pretty='format:%an <%ae>\n%s'" wont-complete = ... would cause the completion to break badly. For now, revert the removal of the case statement until someone comes up with a better way to get keys from git-config. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-09completion: fix completion of git <TAB><TAB>Stephen Boyd
After commit 511a3fc (wrap git's main usage string., 2009-09-12), the bash completion for git commands includes COMMAND and [ARGS] when it shouldn't. Fix this by grepping more strictly for a line with git commands. It's doubtful whether git will ever have commands starting with anything besides numbers and letters so this should be fine. At least by being stricter we'll know when we break the completion earlier. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-08completion: add dirstat and friends to diff optionsv1.6.5-rc3Stephen Boyd
Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-08completion: update am, commit, and logStephen Boyd
git am learned --scissors, git commit learned --dry-run and git log learned --decorate=long|short recently. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-25bash: teach 'git checkout' optionsSZEDER Gábor
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-09-22bash: teach 'git reset --patch'SZEDER Gábor
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-22bash: update 'git stash' completionSZEDER Gábor
This update adds 'git stash (apply|pop) --quiet' and all options known to 'git stash save', and handles the DWIMery from 3c2eb80f (stash: simplify defaulting to "save" and reject unknown options, 2009-08-18). Care is taken to avoid offering subcommands in the DWIM case. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-22bash: rename __git_find_subcommand() to __git_find_on_cmdline()SZEDER Gábor
__git_find_subcommand() was originally meant to check whether subcommands are already present on the command line. But the code is general enough to be used for checking the presence of command line options as well, and the next commit will use it for that purpose, so let's give it a more general name. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13completion: Replace config --list with --get-regexpTodd Zullinger
James Bardin noted that the completion spewed warnings when no git config file is present. This is likely a bug to be fixed in git config, but it's also good to simplify the completion code by using the --get-regexp option as Jeff King pointed out. Signed-off-by: Todd Zullinger <tmz@pobox.com> Trivially-acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-08Add url.<base>.pushInsteadOf: URL rewriting for push onlyJosh Triplett
This configuration option allows systematically rewriting fetch-only URLs to push-capable URLs when used with push. For instance: [url "ssh://example.org/"] pushInsteadOf = "git://example.org/" This will allow clones of "git://example.org/path/to/repo" to subsequently push to "ssh://example.org/path/to/repo", without manually configuring pushurl for that remote. Includes documentation for the new option, bash completion updates, and test cases (both that pushInsteadOf applies to push, that it does not apply to fetch, and that it is ignored when pushURL is already defined). Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-22Merge branch 'gb/apply-ignore-whitespace'Junio C Hamano
* gb/apply-ignore-whitespace: git apply: option to ignore whitespace differences
2009-08-11Merge branch 'mk/grep-max-depth'Junio C Hamano
* mk/grep-max-depth: grep: Add --max-depth option.
2009-08-05git apply: option to ignore whitespace differencesGiuseppe Bilotta
Introduce --ignore-whitespace option and corresponding config bool to ignore whitespace differences while applying patches, akin to the 'patch' program. 'git am', 'git rebase' and the bash git completion are made aware of this option. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-24Show the presence of untracked files in the bash prompt.Daniel Trstenjak
Added the envvar GIT_PS1_SHOWUNTRACKEDFILES to 'git-completion.bash'. When set to a nonempty value, then the char '%' will be shown next to the branch name in the bash prompt. Signed-off-by: Daniel Trstenjak <daniel.trstenjak@science-computing.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>