summaryrefslogtreecommitdiff
path: root/contrib/completion
AgeCommit message (Collapse)AuthorFilesLines
2015-02-11Merge branch 'cj/log-invert-grep'Libravatar Junio C Hamano1-1/+1
"git log --invert-grep --grep=WIP" will show only commits that do not have the string "WIP" in their messages. * cj/log-invert-grep: log: teach --invert-grep option
2015-01-14Merge branch 'tf/prompt-preserve-exit-status'Libravatar Junio C Hamano1-5/+5
Using the exit status of the last command in the prompt, e.g. PS1='$(__git_ps1) $? ', did not work well because the helper function stomped on the exit status. * tf/prompt-preserve-exit-status: git-prompt: preserve value of $? in all cases
2015-01-14Merge branch 'rh/hide-prompt-in-ignored-directory'Libravatar Junio C Hamano1-7/+17
* rh/hide-prompt-in-ignored-directory: git-prompt.sh: allow to hide prompt for ignored pwd git-prompt.sh: if pc mode, immediately set PS1 to a plain prompt
2015-01-14Merge branch 'mm/complete-rebase-autostash'Libravatar Junio C Hamano1-0/+1
* mm/complete-rebase-autostash: git-completion: add --autostash for 'git rebase'
2015-01-14git-prompt: preserve value of $? in all casesLibravatar Tony Finch1-4/+4
Signed-off-by: Tony Finch <dot@dotat.at> Reviewed-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-13log: teach --invert-grep optionLibravatar Christoph Junghans1-1/+1
"git log --grep=<string>" shows only commits with messages that match the given string, but sometimes it is useful to be able to show only commits that do *not* have certain messages (e.g. "show me ones that are not FIXUP commits"). Originally, we had the invert-grep flag in grep_opt, but because "git grep --invert-grep" does not make sense except in conjunction with "--files-with-matches", which is already covered by "--files-without-matches", it was moved it to revisions structure. To have the flag there expresses the function to the feature better. When the newly inserted two tests run, the history would have commits with messages "initial", "second", "third", "fourth", "fifth", "sixth" and "Second", committed in this order. The commits that does not match either "th" or "Sec" is "second" and "initial". For the case insensitive case only "initial" matches. Signed-off-by: Christoph Junghans <ottxor@gentoo.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-07Merge branch 'tf/prompt-preserve-exit-status'Libravatar Junio C Hamano1-0/+4
Using the exit status of the last command in the prompt, e.g. PS1='$(__git_ps1) $? ', did not work well because the helper function stomped on the exit status. * tf/prompt-preserve-exit-status: git-prompt: preserve value of $? inside shell prompt
2015-01-07Merge branch 'pd/completion-filenames-fix'Libravatar Junio C Hamano2-3/+3
The top-of-the-file instruction for completion scripts (in contrib/) did not name the files correctly. * pd/completion-filenames-fix: Update documentation occurrences of filename .sh
2015-01-07git-completion: add --autostash for 'git rebase'Libravatar Matthieu Moy1-0/+1
This option was added in 58794775 (rebase: implement --[no-]autostash and rebase.autostash, 2013-05-12). Completion of "--autosquash" has been there, but this was not; addition of this would require people completing "--autosquash" to type a bit more than before. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-07git-prompt.sh: allow to hide prompt for ignored pwdLibravatar Jess Austin1-0/+13
Optionally set __git_ps1 to display nothing when present working directory is ignored, triggered by the new environment variable GIT_PS1_HIDE_IF_PWD_IGNORED. This environment variable may be overridden on any repository by setting bash.hideIfPwdIgnored to "false". In the absence of GIT_PS1_HIDE_IF_PWD_IGNORED this change has no effect. Many people manage e.g. dotfiles in their home directory with git. This causes the prompt generated by __git_ps1 to refer to that "top level" repo while working in any descendant directory. That can be distracting, so this patch helps one shut off that noise. Signed-off-by: Jess Austin <jess.austin@gmail.com> Signed-off-by: Richard Hansen <rhansen@bbn.com> Reviewed-by: Richard Hansen <rhansen@bbn.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-07git-prompt.sh: if pc mode, immediately set PS1 to a plain promptLibravatar Richard Hansen1-7/+4
At the beginning of __git_ps1, right after determining that the function is running in pc mode, set PS1 to a plain (undecorated) prompt. This makes it possible to simply return early without having to set PS1 if the prompt should not be decorated. Signed-off-by: Richard Hansen <rhansen@bbn.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-22Merge branch 'jg/prompt-localize-temporary'Libravatar Junio C Hamano1-1/+1
"git-prompt" (in contrib/) used a variable from the global scope, possibly contaminating end-user's namespace. * jg/prompt-localize-temporary: git-prompt.sh: make $f local to __git_eread()
2014-12-22Merge branch 'rt/completion-tag'Libravatar Junio C Hamano1-0/+10
* rt/completion-tag: completion: add git-tag options
2014-12-22git-prompt: preserve value of $? inside shell promptLibravatar Tony Finch1-0/+4
If you have a prompt which displays the command exit status, __git_ps1 without this change corrupts it, although it has the correct value in the parent shell: ~/src/git (master) 0 $ set | grep ^PS1 PS1='\w$(__git_ps1) $? \$ ' ~/src/git (master) 0 $ false ~/src/git (master) 0 $ echo $? 1 ~/src/git (master) 0 $ There is a slightly ugly workaround: ~/src/git (master) 0 $ set | grep ^PS1 PS1='\w$(x=$?; __git_ps1; exit $x) $? \$ ' ~/src/git (master) 0 $ false ~/src/git (master) 1 $ This change makes the workaround unnecessary. Signed-off-by: Tony Finch <dot@dotat.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-15Update documentation occurrences of filename .shLibravatar Peter van der Does2-3/+3
Documentation in the completion scripts for Bash and Zsh state the wrong filenames. Signed-off-by: Peter van der Does <peter@avirtualhome.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-12git-prompt.sh: make $f local to __git_eread()Libravatar Justin Guenther1-1/+1
This function uses (non-local) $f to store the value of its first parameter. This can interfere with the user's environment. Signed-off-by: Justin Guenther <jguenther@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-04completion: add git-tag optionsLibravatar Ralf Thielow1-0/+10
Add completion for git-tag options including all options that are currently shown in "git tag -h". Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-25git-send-email: add --transfer-encoding optionLibravatar Paolo Bonzini1-0/+4
The thread at http://thread.gmane.org/gmane.comp.version-control.git/257392 details problems when applying patches with "git am" in a repository with CRLF line endings. In the example in the thread, the repository originated from "git-svn" so it is not possible to use core.eol and friends on it. Right now, the best option is to use "git am --keep-cr". However, when a patch create new files, the patch application process will reject the new file because it finds a "/dev/null\r" string instead of "/dev/null". The problem is that SMTP transport is CRLF-unsafe. Sending a patch by email is the same as passing it through "dos2unix | unix2dos". The newly introduced CRLFs are normally transparent because git-am strips them. The keepcr=true setting preserves them, but it is mostly working by chance and it would be very problematic to have a "git am" workflow in a repository with mixed LF and CRLF line endings. The MIME solution to this is the quoted-printable transfer enconding. This is not something that we want to enable by default, since it makes received emails horrible to look at. However, it is a very good match for projects that store CRLF line endings in the repository. The only disadvantage of quoted-printable is that quoted-printable patches fail to apply if the maintainer uses "git am --keep-cr". This is because the decoded patch will have two carriage returns at the end of the line. Therefore, add support for base64 transfer encoding too, which makes received emails downright impossible to look at outside a MUA, but really just works. The patch covers all bases, including users that still live in the late 80s, by also providing a 7bit content transfer encoding that refuses to send emails with non-ASCII character in them. And finally, "8bit" will add a Content-Transfer-Encoding header but otherwise do nothing. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-29Merge branch 'oc/mergetools-beyondcompare'Libravatar Junio C Hamano1-1/+1
* oc/mergetools-beyondcompare: mergetool: rename bc3 to bc
2014-10-21Merge branch 'js/completion-hide-not-a-repo'Libravatar Junio C Hamano1-1/+2
Some internal error messages leaked out of the bash completion when typing "git cmd <TAB>" and the machinery tried to complete refnames. * js/completion-hide-not-a-repo: completion: silence "fatal: Not a git repository" error
2014-10-21mergetool: rename bc3 to bcLibravatar Junio C Hamano1-1/+1
Beyond Compare version 4 works the same way as version 3, so rename the existing "bc3" adaptor to just "bc", while keeping "bc3" as a backward compatible wrapper. Noticed-by: Olivier Croquette <ocroquette@free.fr> Helped-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-16Merge branch 'jc/completion-no-chdir'Libravatar Junio C Hamano1-11/+7
* jc/completion-no-chdir: completion: use "git -C $there" instead of (cd $there && git ...)
2014-10-14completion: silence "fatal: Not a git repository" errorLibravatar John Szakmeister1-1/+2
It is possible that a user is trying to run a git command and fail to realize that they are not in a git repository or working tree. When trying to complete an operation, __git_refs would fall to a degenerate case and attempt to use "git for-each-ref", which would emit the error. Hide this error message coming from "git for-each-ref". Signed-off-by: John Szakmeister <john@szakmeister.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-09completion: use "git -C $there" instead of (cd $there && git ...)Libravatar Junio C Hamano1-11/+7
We have had "git -C $there" to first go to a different directory and run a Git command without changing the arguments for quite some time. Use it instead of (cd $there && git ...) in the completion script. This allows us to lose the work-around for misfeatures of modern interactive-minded shells that make "cd" unusable in scripts (e.g. end users' $CDPATH taking us to unexpected places in any POSIX shell, and chpwd functions spewing unwanted output in zsh). Based on Øystein Walle's idea, which was raised during the discussion on the solution by Brandon Turner for a problem zsh users had with RVM which mucks with chpwd_functions in users' environments (https://github.com/wayneeseguin/rvm/issues/3076). As $root variable, which is used to direct where to chdir to, is set to "." based on if $2 to __git_index_files is set (not if it is empty), the only caller of the function is fixed not to pass the optional $2 when it does not want us to switch to a different directory. Otherwise we would end up doing "git -C '' command...", which would not work. Maybe we would want "git -C '' command..." to mean "do not chdir anywhere", but that is a spearate topic. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-07completion: add --show-signature for log and showLibravatar David Aguilar1-0/+2
Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-09-19Merge branch 'jk/prompt-stash-could-be-packed' into maintLibravatar Junio C Hamano1-1/+2
* jk/prompt-stash-could-be-packed: git-prompt: do not look for refs/stash in $GIT_DIR
2014-09-19Merge branch 'tb/complete-diff-ignore-blank-lines'Libravatar Junio C Hamano1-2/+2
* tb/complete-diff-ignore-blank-lines: completion: Add --ignore-blank-lines for diff
2014-09-09Merge branch 'jk/prompt-stash-could-be-packed'Libravatar Junio C Hamano1-1/+2
The prompt script checked $GIT_DIR/ref/stash file to see if there is a stash, which was a no-no. * jk/prompt-stash-could-be-packed: git-prompt: do not look for refs/stash in $GIT_DIR
2014-09-03completion: Add --ignore-blank-lines for diffLibravatar Thomas Braun1-2/+2
Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-08-25git-prompt: do not look for refs/stash in $GIT_DIRLibravatar Jeff King1-1/+2
Since dd0b72c (bash prompt: use bash builtins to check stash state, 2011-04-01), git-prompt checks whether we have a stash by looking for $GIT_DIR/refs/stash. Generally external programs should never do this, because they would miss packed-refs. That commit claims that packed-refs does not pack refs/stash, but that is not quite true. It does pack the ref, but due to a bug, fails to prune the ref. When we fix that bug, we would want to be doing the right thing here. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-30Merge branch 'jk/more-push-completion'Libravatar Junio C Hamano1-1/+27
* jk/more-push-completion: completion: complete `git push --force-with-lease=` completion: add some missing options to `git push` completion: complete "unstuck" `git push --recurse-submodules`
2014-07-22completion: complete `git push --force-with-lease=`Libravatar John Keeping1-1/+21
Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-22completion: add some missing options to `git push`Libravatar John Keeping1-0/+1
Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-22completion: complete "unstuck" `git push --recurse-submodules`Libravatar John Keeping1-0/+5
Since the argument to `--recurse-submodules` is mandatory, it does not need to be stuck to the option with `=`. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-25Merge branch 'sp/complete-ext-alias'Libravatar Junio C Hamano1-0/+10
* sp/complete-ext-alias: completion: handle '!f() { ... }; f' and "!sh -c '...' -" aliases
2014-06-13completion: handle '!f() { ... }; f' and "!sh -c '...' -" aliasesLibravatar Steffen Prohaska1-0/+10
'!f() { ... }; f' and "!sh -c '....' -" are recommended patterns for declaring more complex aliases (see git wiki [1]). This commit teaches the completion to handle them. When determining which completion to use for an alias, an opening brace or single quote is now skipped, and the search for a git command is continued. For example, the aliases '!f() { git commit ... }' or "!sh -c 'git commit ...'" now trigger commit completion. Previously, the search stopped on the opening brace or quote, and the completion tried it to determine how to complete, which obviously was useless. The null command ':' is now skipped, so that it can be used as a workaround to declare the desired completion style. For example, the aliases !f() { : git commit ; if ... } f !sh -c ': git commit; if ...' - now trigger commit completion. Shell function declarations now work with or without space before the parens, i.e. '!f() ...' and '!f () ...' both work. [1] https://git.wiki.kernel.org/index.php/Aliases Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27completion: add missing options for git-mergeLibravatar John Keeping1-1/+4
The options added to __git_merge_options are those that git-pull passes to git-merge, since that variable is used by both commands. Those added directly in _git_merge() are specific to git-merge and are not passed thru from git-pull. Reported-by: Haralan Dobrev <hkdobrev@gmail.com> Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27completion: add a note that merge options are sharedLibravatar John Keeping1-0/+1
This should avoid future confusion after a subsequent patch has added some options to __git_merge_options and some directly in _git_merge(). Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-19Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname'Libravatar Junio C Hamano1-17/+39
* rh/prompt-pcmode-avoid-eval-on-refname: git-prompt.sh: don't assume the shell expands the value of PS1
2014-05-19git-prompt.sh: don't assume the shell expands the value of PS1Libravatar Richard Hansen1-17/+39
Not all shells subject the prompt string to parameter expansion. Test whether the shell will expand the value of PS1, and use the result to control whether raw ref names are included directly in PS1. This fixes a regression introduced in commit 8976500 ("git-prompt.sh: don't put unsanitized branch names in $PS1"): zsh does not expand PS1 by default, but that commit assumed it did. The bug resulted in prompts containing the literal string '${__git_ps1_branch_name}' instead of the actual branch name. Reported-by: Caleb Thompson <caleb@calebthompson.io> Signed-off-by: Richard Hansen <rhansen@bbn.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-13Merge branch 'fc/prompt-zsh-read-from-file'Libravatar Junio C Hamano1-8/+8
* fc/prompt-zsh-read-from-file: contrib: completion: fix 'eread()' namespace
2014-05-13contrib: completion: fix 'eread()' namespaceLibravatar Felipe Contreras1-8/+8
Otherwise it might collide with a function of the same name in the user's environment. Suggested-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>
2014-05-02Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname'Libravatar Junio C Hamano1-2/+32
* rh/prompt-pcmode-avoid-eval-on-refname: git-prompt.sh: don't put unsanitized branch names in $PS1
2014-04-22git-prompt.sh: don't put unsanitized branch names in $PS1Libravatar Richard Hansen1-2/+32
Both bash and zsh subject the value of PS1 to parameter expansion, command substitution, and arithmetic expansion. Rather than include the raw, unescaped branch name in PS1 when running in two- or three-argument mode, construct PS1 to reference a variable that holds the branch name. Because the shells do not recursively expand, this avoids arbitrary code execution by specially-crafted branch names such as '$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)'. Signed-off-by: Richard Hansen <rhansen@bbn.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-18Merge branch 'fc/complete-aliased-push'Libravatar Junio C Hamano2-0/+2
* fc/complete-aliased-push: completion: fix completing args of aliased "push", "fetch", etc.
2014-04-14prompt: fix missing file errors in zshLibravatar Felipe Contreras1-7/+14
zsh seems to have a bug while redirecting the stderr of the 'read' command: % read foo 2>/dev/null <foo zsh: no such file or directory: foo Which causes errors to be displayed when certain files are missing. Let's add a convenience function to manually check if the file is readable before calling "read". Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-09completion: fix completing args of aliased "push", "fetch", etc.Libravatar Felipe Contreras2-0/+2
Some commands need the first word to determine the actual action that is being executed, however, the command is wrong when we use an alias, for example 'alias.p=push', if we try to complete 'git p origin ', the result would be wrong because __git_complete_remote_or_refspec() doesn't know where it came from. So let's override words[1], so the alias 'p' is override by the actual command, 'push'. Reported-by: Aymeric Beaumet <aymeric.beaumet@gmail.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-14Merge branch 'ss/completion-rec-sub-fetch-push'Libravatar Junio C Hamano1-1/+18
* ss/completion-rec-sub-fetch-push: completion: teach --recurse-submodules to fetch, pull and push
2014-02-11completion: teach --recurse-submodules to fetch, pull and pushLibravatar Sup Yut Sum1-1/+18
Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-01-27Merge branch 'jk/complete-merge-base'Libravatar Junio C Hamano1-1/+7
* jk/complete-merge-base: completion: handle --[no-]fork-point options to git-rebase completion: complete merge-base options