summaryrefslogtreecommitdiff
path: root/contrib/completion
AgeCommit message (Collapse)AuthorFilesLines
2009-03-07bash completion: teach fetch, pull, and push to complete their optionsLibravatar Jay Soffian1-5/+56
fetch, pull, and push didn't know their options. They do now. merge's options are factored into a variable so they can be shared between _git_merge and _git_pull Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07bash completion: refactor --strategy completionLibravatar Jay Soffian1-18/+20
The code to complete --strategy was duplicated between _git_rebase and _git_merge, and is about to gain a third caller (_git_pull). This patch factors it into its own function. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07bash completion: fix completion issues with fetch, pull, and pushLibravatar Jay Soffian1-49/+60
Sverre Rabbelier noticed a completion issue with push: $ git push ori<tab> git push origin $ git push -f ori<tab> git push -f origin/ Markus Heidelberg pointed out that the issue extends to fetch and pull. The reason is that the current code naively assumes that if COMP_CWORD=2, it should complete a remote name, otherwise it should complete a refspec. This assumption fails if there are any --options. This patch fixes that issue by instead scanning COMP_CWORDS to see if the remote has been completed yet (we now assume the first non-dashed argument is the remote). The new logic is factored into a function, shared by fetch, pull, and push. The new function also properly handles '.' as the remote. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-05Merge branch 'ns/pretty-format'Libravatar Junio C Hamano1-2/+12
* ns/pretty-format: bash completion: add --format= and --oneline options for "git log" Add tests for git log --pretty, --format and --oneline. Add --oneline that is a synonym to "--pretty=oneline --abbrev-commit" Give short-hands to --pretty=tformat:%formatstring Add --format that is a synonym to --pretty
2009-03-05Merge branch 'tp/completion'Libravatar Junio C Hamano1-38/+42
* tp/completion: Fixup: Add bare repository indicator for __git_ps1 Add bare repository indicator for __git_ps1 completion: More fixes to prevent unbound variable errors completion: Better __git_ps1 support when not in working directory completion: Use consistent if [...] convention, not "test" completion: For consistency, change "git rev-parse" to __gitdir calls
2009-02-27bash completion: add --format= and --oneline options for "git log"Libravatar Teemu Likonen1-2/+12
We also add --format= completion for "git show". Signed-off-by: Teemu Likonen <tlikonen@iki.fi> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-24Fixup: Add bare repository indicator for __git_ps1Libravatar Marius Storm-Olsen1-7/+6
Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-23Add bare repository indicator for __git_ps1Libravatar Marius Storm-Olsen1-2/+8
Prefixes the branch name with "BARE:" if you're in a bare repository. Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-18bash completion: only show 'log --merge' if mergingLibravatar Thomas Rast1-1/+6
The gitk completion only shows --merge if MERGE_HEAD is present. Do it the same way for git-log completion. 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-02-18bash completion: refactor common log, shortlog and gitk optionsLibravatar Thomas Rast1-15/+34
Refactor options that are useful for more than one of them into a variable used by the relevant completions. This has the effect of adding the following options to git-log: --branches --tags --remotes --first-parent --dense --sparse --simplify-merges --simplify-by-decoration --first-parent --no-merges The following to git-shortlog: --branches --tags --remotes --first-parent And the following to gitk: --branches --tags --remotes --first-parent --no-merges --max-count= --max-age= --since= --after= --min-age= --until= --before= --dense --sparse --full-history --simplify-merges --simplify-by-decoration --left-right 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-02-16bash: update 'git svn' optionsLibravatar SZEDER Gábor1-6/+25
'git svn' got some new subcommands and otions in the last couple of months. This patch adds completion support for them. In particular: * 'fetch', 'clone', etc.: '--ignore-paths=' * 'init' and 'clone': '--prefix=', '--use-log-author', '--add-author-from' * 'dcommit': '--commit-url', '--revision' * 'log': '--color' * 'rebase': '--dry-run' * 'branch', 'tag', 'blame', 'migrate' subcommands and their options 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-02-16bash: add missing 'git merge' optionsLibravatar SZEDER Gábor1-0/+1
Namely: '--commit', '--stat', '--no-squash', '--ff', '--no-ff'. One might wonder why add options that specify the default behaviour anyway (e.g. '--commit', '--no-squash', etc.). Users can override the default with config options (e.g. 'branch.<name>.mergeoptions', 'merge.log'), but sometimes might still need the default behaviour. 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-02-14bash: fix misspelled 'git svn' optionLibravatar SZEDER Gábor1-1/+1
'--user-log-author' -> '--use-log-author' Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-13bash-completion: Complete the values of color.interactive, color.ui, color.pagerLibravatar Matt Kraai1-1/+5
Signed-off-by: Matt Kraai <kraai@ftbfs.org> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-11completion: More fixes to prevent unbound variable errorsLibravatar Ted Pavlic1-4/+4
Several functions make use of "[-n ...]" and "[-z ...]". In many cases, the variables being tested were declared with "local." However, several __variables are not, and so they must be replaced with their ${__-} equivalents. Signed-off-by: Ted Pavlic <ted@tedpavlic.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-11completion: Better __git_ps1 support when not in working directoryLibravatar Ted Pavlic1-14/+22
If .git/HEAD is not readable, __git_ps1 does nothing. If --is-in-git-dir, __git_ps1 returns " (GIT_DIR!)" as a cautionary note. The previous behavior would show the branch name (and would optionally attempt to determine the dirtyState of the directory, which was impossible because a "git diff" was used). If --is-in-work-tree, __git_ps1 returns the branch name. Additionally, if showDirtyState is on, the dirty state is displayed. Signed-off-by: Ted Pavlic <ted@tedpavlic.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-11completion: Use consistent if [...] convention, not "test"Libravatar Ted Pavlic1-20/+11
The local coding convention in bash completion is to use [...] rather than test. Additionally, if [...]; then is preferred over if [...] then and so matching "if [...]\nthen" were changed accordingly. Signed-off-by: Ted Pavlic <ted@tedpavlic.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-11completion: For consistency, change "git rev-parse" to __gitdir callsLibravatar Ted Pavlic1-2/+2
Signed-off-by: Ted Pavlic <ted@tedpavlic.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-08completion: Get rid of tabbed indentation in comments. Replace with spaces.Libravatar Ted Pavlic1-5/+5
Signed-off-by: Ted Pavlic <ted@tedpavlic.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-08completion: Fix GIT_PS1_SHOWDIRTYSTATE to prevent unbound variable errors.Libravatar Ted Pavlic1-1/+1
Signed-off-by: Ted Pavlic <ted@tedpavlic.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-03bash: offer to show (un)staged changesLibravatar Thomas Rast1-2/+24
Add a bit of code to __git_ps1 that lets it append '*' to the branch name if there are any unstaged changes, and '+' if there are any staged changes. Since this is a rather expensive operation and will force a lot of data into the cache whenever you first enter a repository, you have to enable it manually by setting GIT_PS1_SHOWDIRTYSTATE to a nonempty value. The configuration variable bash.showDirtyState can then be used to disable it again for some repositories. 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-01-23Merge branch 'js/patience-diff'Libravatar Junio C Hamano1-0/+1
* js/patience-diff: bash completions: Add the --patience option Introduce the diff option '--patience' Implement the patience diff algorithm Conflicts: contrib/completion/git-completion.bash
2009-01-21bash completion: add 'rename' subcommand to git-remoteLibravatar Markus Heidelberg1-2/+2
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-01-19bash completion: refactor diff optionsLibravatar Thomas Rast1-15/+21
diff, log and show all take the same diff options. Refactor them from __git_diff and __git_log into a variable, and complete them in __git_show too. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-19bash completion: move pickaxe options to logLibravatar Thomas Rast1-1/+2
Move the options --pickaxe-all and --pickaxe-regex to git-log, where they make more sense than with git-diff. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-18git-svn: Add --localtime option to "fetch"Libravatar Pete Harlan1-1/+1
By default git-svn stores timestamps of fetched commits in Subversion's UTC format. Passing --localtime to fetch will convert them to the timezone of the server on which git-svn is run. This makes the timestamps of a resulting "git log" agree with what "svn log" shows for the same repository. Signed-off-by: Pete Harlan <pgit@pcharlan.com> Acked-by: Eric Wong <normalperson@yhbt.net>
2009-01-17bash: refactor 'git log --pretty=<format>' optionsLibravatar SZEDER Gábor1-4/+4
Both 'git log' and 'show' have the same '--pretty=<format>' option with the same formats. So refactor these formats into a common variable. While at it, also add 'format:' to the list. 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-01-17bash: add missing format-patch command line optionsLibravatar SZEDER Gábor1-0/+2
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-01-17bash: remove unnecessary checks for long options with argumentLibravatar SZEDER Gábor1-2/+0
__gitcomp takes care of it since 5447aac7 (bash: fix long option with argument double completion, 2008-03-05) 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-01-15bash-completion: Add comments to remind about required argumentsLibravatar Ted Pavlic1-0/+15
Add a few simple comments above commands that take arguments. These comments are meant to remind developers of potential problems that can occur when the script is sourced on systems with "set -u." Any function which requires arguments really ought to be called with explicit arguments given. Also adds a #!bash to the top of bash completions so that editing software can always identify that the file is of sh type. Signed-off-by: Ted Pavlic <ted@tedpavlic.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-15bash-completion: Try bash completions before simple filetypeLibravatar Ted Pavlic1-3/+6
When a git completion is not found, a bash shell should try bash-type completions first before going to standard filetype completions. This patch adds "-o bashdefault" to the completion line. If that option is not available, it uses the old method. This behavior was inspired by Mercurial's bash completion script. Signed-off-by: Ted Pavlic <ted@tedpavlic.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-15bash-completion: Support running when set -u is enabledLibravatar Ted Pavlic1-9/+9
Under "set -u" semantics, it is an error to access undefined variables. Some user environments may enable this setting in the interactive shell. In any context where the completion functions access an undefined variable, accessing a default empty string (aka "${1-}" instead of "$1") is a reasonable way to code the function, as it silences the undefined variable error while still supplying an empty string. In this patch, functions that should always take an argument still use $1. Functions that have optional arguments use ${1-}. Signed-off-by: Ted Pavlic <ted@tedpavlic.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-10bash completion: Use 'git add' completions for 'git stage'Libravatar Lee Marlow1-0/+1
Signed-off-by: Lee Marlow <lee.marlow@gmail.com> Trivially-Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-10bash completion: Add '--intent-to-add' long option for 'git add'Libravatar Lee Marlow1-1/+1
Signed-off-by: Lee Marlow <lee.marlow@gmail.com> Trivially-Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-07bash completions: Add the --patience optionLibravatar Johannes Schindelin1-0/+2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-07Merge branch 'rs/diff-ihc'Libravatar Junio C Hamano1-0/+2
* rs/diff-ihc: diff: add option to show context between close hunks Conflicts: Documentation/diff-options.txt
2009-01-05bash: add '--merge' to 'git reset'Libravatar SZEDER Gábor1-1/+1
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-29diff: add option to show context between close hunksLibravatar René Scharfe1-0/+2
Merge two hunks if there is only the specified number of otherwise unshown context between them. For --inter-hunk-context=1, the resulting patch has the same number of lines but shows uninterrupted context instead of a context header line in between. Patches generated with this option are easier to read but are also more likely to conflict if the file to be patched contains other changes. This patch keeps the default for this option at 0. It is intended to just make the feature available in order to see its advantages and downsides. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-15bash completion: Sync config variables with their man pagesLibravatar Lee Marlow1-7/+80
Add 'normal' to config color options. Add 'mergeoptions' to branch config options. Add 'proxy' and 'mirror' to remote config options. Signed-off-by: Lee Marlow <lee.marlow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-15bash completion: Sort config completion variablesLibravatar Lee Marlow1-37/+40
Sort the config variables to make sync-ing them with Documents/config.txt easier in the future. Signed-off-by: Lee Marlow <lee.marlow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-27Merge branch 'maint'Libravatar Junio C Hamano1-34/+9
* maint: sha1_file.c: resolve confusion EACCES vs EPERM sha1_file: avoid bogus "file exists" error message git checkout: don't warn about unborn branch if -f is already passed bash: offer refs instead of filenames for 'git revert' bash: remove dashed command leftovers git-p4: fix keyword-expansion regex fast-export: use an unsorted string list for extra_refs Add new testcase to show fast-export does not always exports all tags
2008-11-27bash: offer refs instead of filenames for 'git revert'Libravatar SZEDER Gábor1-1/+1
The completion script for 'git revert' currently offers options and filenames. However, 'git revert' doesn't take any filenames from the command line, but a single commit. Therefore, it's more sane to offer refs instead. 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>
2008-11-27bash: complete full refsLibravatar SZEDER Gábor1-4/+15
Sometimes it's handy to complete full refs, e.g. the user has some refs outside of refs/{heads,remotes,tags} or the user wants to complete some git command's special refs (like 'git show refs/bisect/bad'). To do that, we check whether the ref to be completed starts with 'refs/' or is 'refs' (to reduce the risk of matching 'refs-'). If it does, then we offer full refs for completion; otherwise everything works as usual. This way the impact on the common case is fairly small (hopefully not many users have branches or tags starting with 'refs'), and in the special case the cost of typing out 'refs' is bearable. While at it, also remove the unused 'cmd' variable from '__git_refs'. 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>
2008-11-27bash: remove dashed command leftoversLibravatar SZEDER Gábor1-33/+8
Commit 5a625b07 (bash: remove fetch, push, pull dashed form leftovers, 2008-10-03) did that already, but there were still some git-cmd left here and there. 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>
2008-10-31Merge branch 'maint'Libravatar Junio C Hamano1-0/+2
* maint: git-svn: change dashed git-commit-tree to git commit-tree Documentation: clarify information about 'ident' attribute bash completion: add doubledash to "git show" Use test-chmtime -v instead of perl in t5000 to get mtime of a file Add --verbose|-v to test-chmtime asciidoc: add minor workaround to add an empty line after code blocks Plug a memleak in builtin-revert Add file delete/create info when we overflow rename_limit Install git-cvsserver in $(bindir) Install git-shell in bindir, too
2008-10-31bash completion: add doubledash to "git show"Libravatar Markus Heidelberg1-0/+2
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-20bash completion: Add 'workflows' to 'git help'Libravatar Lee Marlow1-0/+1
Completion for new workflow documentation introduced in f948dd8 Signed-off-by: Lee Marlow <lee.marlow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-09Merge branch 'mw/sendemail'Libravatar Shawn O. Pearce1-1/+2
* mw/sendemail: bash completion: Add --[no-]validate to "git send-email" send-email: signedoffcc -> signedoffbycc, but handle both Docs: send-email: Create logical groupings for man text Docs: send-email: Create logical groupings for --help text Docs: send-email: Remove unnecessary config variable description Docs: send-email: --chain_reply_to -> --[no-]chain-reply-to send-email: change --no-validate to boolean --[no-]validate Docs: send-email: Man page option ordering Docs: send-email usage text much sexier Docs: send-email's usage text and man page mention same options
2008-10-06Merge branch 'maint'Libravatar Shawn O. Pearce1-27/+9
* maint: Update release notes for 1.6.0.3 Teach rebase -i to honor pre-rebase hook docs: describe pre-rebase hook do not segfault if make_cache_entry failed make prefix_path() never return NULL fix bogus "diff --git" header from "diff --no-index" Fix fetch/clone --quiet when stdout is connected builtin-blame: Fix blame -C -C with submodules. bash: remove fetch, push, pull dashed form leftovers Conflicts: diff.c
2008-10-05bash: remove fetch, push, pull dashed form leftoversLibravatar SZEDER Gábor1-27/+9
We don't provide complation for git-commands in dashed form anymore, so there is no need to keep those cases. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Tested-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>