summaryrefslogtreecommitdiff
path: root/contrib/completion/git-completion.bash
AgeCommit message (Collapse)AuthorFilesLines
2011-06-26Merge branch 'maint'Libravatar Junio C Hamano1-1/+1
* maint: completion: replace core.abbrevguard to core.abbrev
2011-06-24Merge branch 'maint-1.7.4' into maintLibravatar Junio C Hamano1-1/+1
* maint-1.7.4: completion: replace core.abbrevguard to core.abbrev
2011-06-24completion: replace core.abbrevguard to core.abbrevLibravatar Namhyung Kim1-1/+1
The core.abbrevguard config variable had removed and now core.abbrev has been used instead. Teach it. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-30Merge branch 'mk/grep-pcre'Libravatar Junio C Hamano1-1/+2
* mk/grep-pcre: git-grep: Fix problems with recently added tests git-grep: Update tests (mainly for -P) Makefile: Pass USE_LIBPCRE down in GIT-BUILD-OPTIONS git-grep: update tests now regexp type is "last one wins" git-grep: do not die upon -F/-P when grep.extendedRegexp is set. git-grep: Bail out when -P is used with -F or -E grep: Add basic tests configure: Check for libpcre git-grep: Learn PCRE grep: Extract compile_regexp_failed() from compile_regexp() grep: Fix a typo in a comment grep: Put calls to fixmatch() and regmatch() into patmatch() contrib/completion: --line-number to git grep Documentation: Add --line-number to git-grep synopsis
2011-05-16Merge branch 'sg/completion-updates'Libravatar Junio C Hamano1-4/+16
* sg/completion-updates: Revert "completion: don't declare 'local words' to make zsh happy" git-completion: fix regression in zsh support completion: move private shopt shim for zsh to __git_ namespace completion: don't declare 'local words' to make zsh happy
2011-05-10Merge branch 'fc/completion-zsh' into sg/completion-updatesLibravatar Junio C Hamano1-0/+8
* fc/completion-zsh: git-completion: fix regression in zsh support
2011-05-10Revert "completion: don't declare 'local words' to make zsh happy"Libravatar Junio C Hamano1-6/+2
This reverts commit 3bee6a4733a1ff03b9cc659ea026c6dc17567d4d, as the fix that will be used by upstream zsh folks should make it unnecessary.
2011-05-10git-completion: fix regression in zsh supportLibravatar Felipe Contreras1-0/+8
The zsh support of git-completion script in contrib/ is broken for current versions of zsh, and does not notice when there's a subcommand. For example: "git log origi<TAB>" gives no completions because it would try to find a "git origi..." command. This will be fixed by zsh 4.3.12, but for now we can workaround it by backporting the same fix as zsh folks implemented. The problem started after commit v1.7.4-rc0~11^2~2 (bash: get --pretty=m<tab> completion to work with bash v4), which introduced _get_comp_words_by_ref() that comes from bash-completion[1] scripts, and relies on the 'words' variable. However, it turns out 'words' is a special variable used by zsh completion. From zshcompwid(1): [...] the parameters are reset on each function exit (including nested function calls from within the completion widget) to the values they had when the function was entered. As a result, subcommand words are lost. Ouch. This is now fixed in the latest master branch of zsh[2] by simply defining 'words' as hidden (typeset -h), which removes the special meaning inside the emulated bash function. So let's do the same. Jonathan Nieder helped on the commit message. [1] http://bash-completion.alioth.debian.org/ [2] http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=commitdiff;h=e880604f029088f32fb1ecc39213d720ae526aaa Reported-by: Stefan Haller <lists@haller-berlin.de> Comments-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09git-grep: Learn PCRELibravatar Michał Kiedrowicz1-0/+1
This patch teaches git-grep the --perl-regexp/-P options (naming borrowed from GNU grep) in order to allow specifying PCRE regexes on the command line. PCRE has a number of features which make them more handy to use than POSIX regexes, like consistent escaping rules, extended character classes, ungreedy matching etc. git isn't build with PCRE support automatically. USE_LIBPCRE environment variable must be enabled (like `make USE_LIBPCRE=YesPlease`). Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-08completion: move private shopt shim for zsh to __git_ namespaceLibravatar Jonathan Nieder1-4/+8
Most zsh users probably probably do not expect a custom shopt function to enter their environment just because they ran "source ~/.git-completion.sh". Such namespace pollution makes development of other scripts confusing (because it makes the bash-specific shopt utility seem to be available in zsh) and makes git's tab completion script brittle (since any other shell snippet implementing some other subset of shopt will break it). Rename the shopt shim to the more innocuous __git_shopt to be a good citizen (with two underscores to avoid confusion with completion rules for a hypothetical "git shopt" command). Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-06Merge branch 'sg/completion-cleanup'Libravatar Junio C Hamano1-161/+60
* sg/completion-cleanup: completion: remove unnecessary _get_comp_words_by_ref() invocations completion: don't modify the $cur variable in completion functions
2011-05-05contrib/completion: --line-number to git grepLibravatar Michał Kiedrowicz1-1/+1
The "-n" option of "git grep" gained a synonym "--line-number" with commit 7d6cb10b ("grep: Add the option '--line-number'", 2011-03-28). Teach bash-completion about it. Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-02Merge branch 'jk/notes-ui-updates'Libravatar Junio C Hamano1-1/+1
* jk/notes-ui-updates: contrib/completion: --notes, --no-notes log/pretty-options: Document --[no-]notes and deprecate old notes options revision.c: make --no-notes reset --notes list revision.c: support --notes command-line option notes: refactor display notes default handling notes: refactor display notes extra refs field revision.c: refactor notes ref expansion notes: make expand_notes_ref globally accessible
2011-04-28completion: don't declare 'local words' to make zsh happyLibravatar SZEDER Gábor1-2/+6
The "_get_comp_words_by_ref -n := words" command from the bash_completion library reassembles a modified version of COMP_WORDS with ':' and '=' no longer treated as word separators and stores it in the ${words[@]} array. Git's programmable tab completion script uses this to abstract away the difference between bash v3's and bash v4's definitions of COMP_WORDS (bash v3 used shell words, while bash v4 breaks at separator characters); see v1.7.4-rc0~11^2~2 (bash: get --pretty=m<tab> completion to work with bash v4, 2010-12-02). zsh has (or rather its completion functions have) another idea about what ${words[@]} should contain: the array is prepopulated with the words from the command it is completing. For reasons that are not well understood, when git-completion.bash reserves its own "words" variable with "local words", the variable becomes empty and cannot be changed from then on. So the completion script neglects the arguments it has seen, and words complete like git subcommand names. For example, typing "git log origi<TAB>" gives no completions because there are no "git origi..." commands. However, when this words variable is not declared as local but is just populated by _get_comp_words_by_ref() and then read in various completion functions, then zsh seems to be happy about it and our completion script works as expected. So, to get our completion script working again under zsh and to prevent the words variable from leaking into the shell environment under bash, we will only declare words as local when using bash. Reported-by: Stefan Haller <lists@haller-berlin.de> Suggested-by: Felipe Contreras <felipe.contreras@gmail.com> Explained-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-28completion: remove unnecessary _get_comp_words_by_ref() invocationsLibravatar SZEDER Gábor1-105/+11
In v1.7.4-rc0~11^2~2 (bash: get --pretty=m<tab> completion to work with bash v4, 2010-12-02) we started to use _get_comp_words_by_ref() to access completion-related variables. That was large change, and to make it easily reviewable, we invoked _get_comp_words_by_ref() in each completion function and systematically replaced every occurance of bash's completion-related variables ($COMP_WORDS and $COMP_CWORD) with variables set by _get_comp_words_by_ref(). This has the downside that _get_comp_words_by_ref() is invoked several times during a single completion. The worst offender is perhaps 'git log mas<TAB>': during the completion of 'master' _get_comp_words_by_ref() is invoked no less than six times. However, the variables $prev, $cword, and $words provided by _get_comp_words_by_ref() are not modified in any of the completion functions, and the previous commit ensures that the $cur variable is not modified as well. This makes it possible to invoke _get_comp_words_by_ref() to get those variables only once in our toplevel completion functions _git() and _gitk(), and all other completion functions will inherit them. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-28completion: don't modify the $cur variable in completion functionsLibravatar SZEDER Gábor1-57/+50
Since v1.7.4-rc0~11^2~2 (bash: get --pretty=m<tab> completion to work with bash v4, 2010-12-02) we use _get_comp_words_by_ref() to access completion-related variables, and the $cur variable holds the word containing the current cursor position in all completion functions. This $cur variable is left unchanged in most completion functions; there are only four functions modifying its value, namely __gitcomp(), __git_complete_revlist_file(), __git_complete_remote_or_refspec(), and _git_config(). If this variable were never modified, then it would allow us a nice optimisation and cleanup. Therefore, this patch assigns $cur to an other local variable and uses that for later modifications in those four functions. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-27Automatically autoload bashcompinit for ZSH, when neededLibravatar Marius Storm-Olsen1-8/+8
If bashcompinit has not already been autoloaded, do so automatically, as it is required to properly parse the git-completion file with ZSH. Helped-by: Felipe Contreras Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-14contrib/completion: --notes, --no-notesLibravatar Michael J Gruber1-1/+1
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-26Merge branch 'mg/rev-list-n-parents'Libravatar Junio C Hamano1-0/+2
* mg/rev-list-n-parents: tests: avoid nonportable {foo,bar} glob rev-list --min-parents,--max-parents: doc, test and completion revision.c: introduce --min-parents and --max-parents options t6009: use test_commit() from test-lib.sh
2011-03-26Merge branch 'jp/completion-help-alias'Libravatar Junio C Hamano1-1/+1
* jp/completion-help-alias: git-completion: Add git help completion for aliases
2011-03-23rev-list --min-parents,--max-parents: doc, test and completionLibravatar Michael J Gruber1-0/+2
This also adds test for "--merges" and "--no-merges" which we did not have so far. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-22Merge branch 'sg/complete-symmetric-diff'Libravatar Junio C Hamano1-14/+17
* sg/complete-symmetric-diff: bash: complete 'git diff ...branc<TAB>' bash: fix misindented esac statement in __git_complete_file()
2011-03-22git-completion: Add git help completion for aliasesLibravatar Jakob Pfender1-1/+1
Enable bash completion for "git help <alias>", analogous to "git <alias>", which was already implemented. Signed-off-by: Jakob Pfender <jpfender@elegosoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-19Merge branch 'ss/mergetool--lib'Libravatar Junio C Hamano1-1/+1
* ss/mergetool--lib: mergetool--lib: Add Beyond Compare 3 as a tool mergetool--lib: Sort tools alphabetically for easier lookup
2011-03-10bash: complete 'git diff ...branc<TAB>'Libravatar SZEDER Gábor1-13/+16
While doing a final sanity check before merging a topic Bsomething, it is a good idea to review what damage Bsomething branch would make, by running: $ git diff ...Bsomething Unfortunately, our completion script for 'git diff' doesn't offer anything after '...'. This is because 'git diff's completion function invokes __git_complete_file() for non-option arguments to complete the '<tree>:<path>' extended SHA-1 notation, but this helper function doesn't support refs after '...' or '..'. Completion of refs after '...' or '..' is supported by the __git_complete_revlist() helper function, but that doesn't support '<tree>:<path>'. To support both '...<ref>' and '<tree>:<path>' notations for 'git diff', this patch, instead of adding yet another helper function, joins __git_complete_file() and __git_complete_revlist() into the new common function __git_complete_revlist_file(). The old helper functions __git_complete_file() and __git_complete_revlist() are changed to be a direct wrapper around the new __git_complete_revlist_file(), because they might be used in user-supplied completion scripts and we don't want to break them. This change will cause some wrong suggestions for other commands which use __git_complete_file() ('git diff' and friends) or __git_complete_revlist() ('git log' and friends), e.g. 'git diff ...master:Doc<TAB>' and 'git log master:Doc<TAB>' will complete the path to 'Documentation/', although neither commands make any sense. However, both of these were actively wrong to begin with as soon as the user entered the ':', so there is no real harm done. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-10bash: fix misindented esac statement in __git_complete_file()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>
2011-02-28mergetool--lib: Add Beyond Compare 3 as a toolLibravatar Sebastian Schuberth1-1/+1
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Tested-by: Chris Packham <judge.packham@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21bash: teach __git_ps1 about CHERRY_PICK_HEADLibravatar Jay Soffian1-0/+2
Make the git prompt (when enabled) show a CHERRY-PICKING indicator when we are in the middle of a conflicted cherry-pick, analogous to the existing MERGING and BISECTING flags. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22Merge branch 'pd/bash-4-completion'Libravatar Junio C Hamano1-78/+290
* pd/bash-4-completion: bash: simple reimplementation of _get_comp_words_by_ref bash: get --pretty=m<tab> completion to work with bash v4 Conflicts: contrib/completion/git-completion.bash
2010-12-21Merge branch 'tc/completion-reflog'Libravatar Junio C Hamano1-1/+12
* tc/completion-reflog: bash completion: add basic support for git-reflog
2010-12-20completion: add missing configuration variablesLibravatar Martin von Zweigbergk1-4/+66
Quite a few configuration variables have been added since 226b343 (completion: add missing configuration variables to _git_config(), 2009-05-03). Add these variables to the Bash completion script. Also remove the obsolete 'add.ignore-errors' and 'color.grep.external', as well as 'diff.renameLimit.', which never existed and rename the misspelled 'sendemail.aliasesfiletype'. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-17bash completion: add basic support for git-reflogLibravatar Tay Ray Chuan1-1/+12
"Promote" the reflog command out of plumbing, so that we now run completion for it. After all, it's listed under porcelain (ancillary), and we do run completion for those commands. Add basic completion for the three subcommands - show, expire, delete. Try completing refs for these too. Helped-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-15Merge branch 'master' (early part) into pd/bash-4-completionLibravatar Jonathan Nieder1-5/+74
* 'master' (early part): (529 commits) completion: fix zsh check under bash with 'set -u' Fix copy-pasted comments related to tree diff handling. Git 1.7.3.2 {cvs,svn}import: use the new 'git read-tree --empty' t/t9001-send-email.sh: fix stderr redirection in 'Invalid In-Reply-To' Clarify and extend the "git diff" format documentation git-show-ref.txt: clarify the pattern matching documentation: git-config minor cleanups Update test script annotate-tests.sh to handle missing/extra authors Better advice on using topic branches for kernel development Documentation: update implicit "--no-index" behavior in "git diff" Documentation: expand 'git diff' SEE ALSO section Documentation: diff can compare blobs Documentation: gitrevisions is in section 7 fast-import: Allow filemodify to set the root shell portability: no "export VAR=VAL" CodingGuidelines: reword parameter expansion section Documentation: update-index: -z applies also to --index-info gitweb: Improve behavior for actionless path_info gitweb URLs gitweb: Fix bug in evaluate_path_info ... Conflicts: GIT-VERSION-GEN RelNotes contrib/completion/git-completion.bash
2010-12-14bash: simple reimplementation of _get_comp_words_by_refLibravatar Jonathan Nieder1-8/+110
Add a minimal implementation of _get_comp_words_by_ref so $ git show head:g <tab><tab> on bash 4 can complete paths within the head commit without requiring the bash_completion functions to be loaded. This is a follow-up to the previous patch (bash: get --pretty=m<tab> completion to work with bash v4). Based on bash-completion 2.x (commit bf763033, 2010-10-26) but tweaked for simplicity and to allow zsh to parse the code. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Improved-by: SZEDER Gábor <szeder@ira.uka.de>
2010-12-14bash: get --pretty=m<tab> completion to work with bash v4Libravatar Peter van der Does1-76/+160
Bash's programmable completion provides the COMP_WORDS array variable, which holds the individual words in the current command line. In bash versions prior to v4 "words are split on shell metacharacters as the shell parser would separate them" (quote from bash v3.2.48's man page). This behavior has changed with bash v4, and the command line "is split into words as readline would split it, using COMP_WORDBREAKS as" "the set of characters that the readline library treats as word separators" (quote from bash v4's man page). Since COMP_WORDBREAKS contains the characters : and = by default, this behavior change in bash affects git's completion script. For example, before bash 4, running $ git log --pretty=m <tab><tab> would give a list of pretty-printing formats starting with 'm' but now it completes on branch names. It would be possible to work around this by removing '=' and ':' from COMP_WORDBREAKS, but as noticed in v1.5.6.4~9^2 (bash completion: Resolve git show ref:path<tab> losing ref: portion, 2008-07-15), that would break *other* completion scripts. The bash-completion library includes a better workaround: the _get_comp_words_by_ref function re-assembles a copy of COMP_WORDS, excluding a collection of word separators of the caller's choice. Use it. As a bonus, this also improves behavior when tab is pressed with the cursor in the middle of a word. To avoid breaking setups with the bash-completion library not already loaded, if the _get_comp_words_by_ref function is not defined then a shim that just reads COMP_WORDS will be used instead (no change from the current behavior in that case). Signed-off-by: Peter van der Does <peter@avirtualhome.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Explained-by: SZEDER Gábor <szeder@ira.uka.de>
2010-12-01Merge branch 'maint'Libravatar Junio C Hamano1-1/+1
* maint: add: introduce add.ignoreerrors synonym for add.ignore-errors bash: Match lightweight tags in prompt git-commit.txt: (synopsis): move -i and -o before "--"
2010-12-01Merge branch 'maint-1.7.2' into maintLibravatar Junio C Hamano1-1/+1
* maint-1.7.2: add: introduce add.ignoreerrors synonym for add.ignore-errors bash: Match lightweight tags in prompt git-commit.txt: (synopsis): move -i and -o before "--"
2010-12-01bash: Match lightweight tags in promptLibravatar knittl1-1/+1
The bash prompt would display a commit's object name when having checked out a lightweight tag. Provide `--tags` to `git describe` in the completion script, so it will display lightweight tag names, as it already does for annotated tags. Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-17Merge branch 'kb/completion-checkout'Libravatar Junio C Hamano1-3/+27
* kb/completion-checkout: completion: Support the DWIM mode for git checkout
2010-11-17Merge branch 'sg/completion'Libravatar Junio C Hamano1-15/+64
* sg/completion: bash: support pretty format aliases bash: support more 'git notes' subcommands and their options bash: not all 'git bisect' subcommands make sense when not bisecting bash: offer refs for 'git bisect start'
2010-10-28completion: fix zsh check under bash with 'set -u'Libravatar Mark Lodato1-3/+3
Commit 06f44c3 (completion: make compatible with zsh) broke bash compatibility with 'set -u': a warning was generated when checking $ZSH_VERSION. The solution is to supply a default value, using ${ZSH_VERSION-}. Thanks to SZEDER Gábor for the fix. Signed-off-by: Mark Lodato <lodatom@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-26Merge branch 'ml/completion-zsh'Libravatar Junio C Hamano1-4/+46
* ml/completion-zsh: completion: make compatible with zsh
2010-10-13completion: Support the DWIM mode for git checkoutLibravatar Kevin Ballard1-3/+27
Ever since commit 70c9ac2 (DWIM: "git checkout frotz" to "git checkout -b frotz origin/frotz"), git checkout has supported a DWIM mode where it creates a local tracking branch for a remote branch if just the name of the remote branch is specified on the command-line and only one remote has a branch with that name. Teach the bash completion script to understand this DWIM mode and provide such remote-tracking branch names as possible completions. Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13bash: support pretty format aliasesLibravatar SZEDER Gábor1-4/+17
Users can have their own pretty format aliases since 8028184 (pretty: add aliases for pretty formats, 2010-05-02), so let's offer those after '--pretty=' and '--format=' for 'log' and 'show', too. Similar to the completion of aliases, this will invoke 'git config' each time pretty aliases needs to be completed, so changes in pretty.* configuration will be reflected immediately. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13bash: support more 'git notes' subcommands and their optionsLibravatar SZEDER Gábor1-9/+41
The current completion function for 'git notes' only supported the 'edit' and 'show' subcommands and none of their options. This patch adds support for all missing subcommands, options, and their arguments (files or refs), if any. The code responsible for completing subcommand looks different compared to the completion functions of other git commands with subcommands. This is because of the '--ref <notes-ref>' option which comes before the subcommand (i.e. git notes --ref <notes-ref> add). Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13bash: not all 'git bisect' subcommands make sense when not bisectingLibravatar SZEDER Gábor1-1/+5
... but only 'start' and 'replay'. The other commands will either error out or offer to start bisecting for the user. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13bash: offer refs for 'git bisect start'Libravatar SZEDER Gábor1-1/+1
The completion script only offered path completion after 'git bisect start', although bad and good refs could also be specified before the doubledash. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27contrib/completion: --no-index option to git diffLibravatar Michael J Gruber1-1/+1
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09completion: make compatible with zshLibravatar Mark Lodato1-4/+46
Modify git-completion.bash so that it also works with zsh when using bashcompinit. In particular: declare -F Zsh doesn't have the same 'declare -F' as bash, but 'declare -f' is the same, and it works just as well for our purposes. ${var:2} Zsh does not implement ${var:2} to skip the first 2 characters, but ${var#??} works in both shells to replace the first 2 characters with nothing. Thanks to Jonathan Nieder for the suggestion. for (( n=1; "$n" ... )) Zsh does not allow "$var" in arithmetic loops. Instead, pre-compute the endpoint and use the variables without $'s or quotes. shopt Zsh uses 'setopt', which has a different syntax than 'shopt'. Since 'shopt' is used infrequently in git-completion, we provide a bare-bones emulation. emulate -L bash KSH_TYPESET Zsh offers bash emulation, which turns on a set of features to closely resemble bash. In particular, this enables SH_WORDSPLIT, which splits scalar variables on word boundaries in 'for' loops. We also need to set KSH_TYPESET, to fix "local var=$(echo foo bar)" issues. The last set of options are turned on only in _git and _gitk. Some of the sub-functions may not work correctly if called directly. Signed-off-by: Mark Lodato <lodatom@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-30Merge branch 'tr/rev-list-count'Libravatar Junio C Hamano1-1/+143
* 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