summaryrefslogtreecommitdiffstats
path: root/contrib (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'jk/complete-branch-force-delete'Junio C Hamano2021-02-121-2/+4
|\ | | | | | | | | | | | | | | | | | | | | The command line completion (in contrib/) completed "git branch -d" with branch names, but "git branch -D" offered tagnames in addition, which has been corrected. "git branch -M" had the same problem. * jk/complete-branch-force-delete: doc/git-branch: fix awkward wording for "-c" completion: handle other variants of "branch -m" completion: treat "branch -D" the same way as "branch -d"
| * completion: handle other variants of "branch -m"Jeff King2021-02-031-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | We didn't special-case "branch -M" (with a capital M) the same as "branch -m", nor any of the "--copy" variants. As a result these offered any ref as the next candidate, and not just branch names. Note that I rewrapped case-arm line since it's now quite long, and likewise the one below it for consistency. I also re-ordered the existing "-D" to make it more obvious how the cases group together. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * completion: treat "branch -D" the same way as "branch -d"Jeff King2021-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | The former offers not just branches but tags as completion candidates. Mimic how "branch -d" limits its suggestion to branch names. Reported-by: Paul Jolly <paul@myitcv.io> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Remove support for v1 of the PCRE libraryÆvar Arnfjörð Bjarmason2021-01-241-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove support for using version 1 of the PCRE library. Its use has been discouraged by upstream for a long time, and it's in a bugfix-only state. Anyone who was relying on v1 in particular got a nudge to move to v2 in e6c531b808 (Makefile: make USE_LIBPCRE=YesPlease mean v2, not v1, 2018-03-11), which was first released as part of v2.18.0. With this the LIBPCRE2 test prerequisites is redundant to PCRE. But I'm keeping it for self-documentation purposes, and to avoid conflict with other in-flight PCRE patches. I'm also not changing all of our own "pcre2" names to "pcre", i.e. the inverse of 6d4b5747f0 (grep: change internal *pcre* variable & function names to be *pcre1*, 2017-05-25). I don't see the point, and it makes the history/blame harder to read. Maybe if there's ever a PCRE v3... Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | completion: add proper public __git_completeFelipe Contreras2021-01-051-7/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When __git_complete was introduced, it was meant to be temporarily, while a proper guideline for public shell functions was established (tentatively _GIT_complete), but since that never happened, people in the wild started to use __git_complete, even though it was marked as not public. Eight years is more than enough wait, let's mark this function as public, and make it a bit more user-friendly. So that instead of doing: __git_complete gk __gitk_main The user can do: __git_complete gk gitk And instead of: __git_complete gf _git_fetch Do: __git_complete gf git_fetch Backwards compatibility is maintained. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | completion: bash: improve function detectionFelipe Contreras2021-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | 1. We should quote the argument 2. We don't need two redirections 3. A safeguard for arguments (-a) would be good Suggested-by: René Scharfe <l.s.r@web.de> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | completion: bash: add __git_have_func helperFelipe Contreras2021-01-051-3/+7
|/ | | | | | | | This makes the code more readable, and also will help when new code wants to do similar checks. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'js/cmake-extra-built-ins-fix'Junio C Hamano2020-12-141-4/+11
|\ | | | | | | | | | | | | VSbuild fix. * js/cmake-extra-built-ins-fix: cmake: determine list of extra built-ins dynamically
| * cmake: determine list of extra built-ins dynamicallyJohannes Schindelin2020-12-041-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | In 0a21d0e08902 (Makefile: mark git-maintenance as a builtin, 2020-12-01), we marked git-maintenance as a builtin in the Makefile, but forgot to do the same in `CMakeLists.txt`. Rather than always play catch-up and adjust `git_builtin_extra` manually, use the `BUILT_INS` definitions in the Makefile as authoritative source and generate `git_builtin_extra` dynamically. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'da/vs-build-iconv-fix'Junio C Hamano2020-12-141-1/+1
|\ \ | | | | | | | | | | | | | | | | | | Build update. * da/vs-build-iconv-fix: ci(vs-build): stop passing the iconv library location explicitly
| * | ci(vs-build): stop passing the iconv library location explicitlyDennis Ameling2020-12-041-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Something changed in `vcpkg` (which we use in our Visual C++ build to provide the dependencies such as libcurl) and our `vs-build` job started failing in CI. The reason is that we had a work-around in place to help CMake find iconv, and this work-around is neither needed nor does it work anymore. For the full discussion with the vcpkg project, see this comment: https://github.com/microsoft/vcpkg/issues/14780#issuecomment-735368280 Signed-off-by: Dennis Ameling <dennis@dennisameling.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'fc/zsh-completion'Junio C Hamano2020-12-092-1/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | Hotfix for a recent breakage. * fc/zsh-completion: completion: bash: fix gitk alias regression completion: zsh: fix file completion regression
| * | completion: bash: fix gitk alias regressionFelipe Contreras2020-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Long time ago when the _git_complete helper was introduced, _gitk was replaced with __gitk_main, and a placeholder for backwards compatibility pointing to __git_wrap_main_gitk was left in place. When "__git_complete gitk __gitk_main" was called, that created the __git_wrap__gitk_main helper, which is just basically "__git_func_wrap __gitk_main" plus `complete` options. Unfortunately the commit b0a4b2d257 (completion: add support for backwards compatibility, 2012-05-19) missed a previous instance of a call to _gitk in _git_gitk So, basically we had __git_wrap__git_main -> __git_func_wrap __git_main -> __git_complete_command gitk -> _git_gitk -> _gitk -> __git_wrap__gitk_main -> __git_func_wrap __gitk_main -> __gitk_main. There was never any need to call __git_func_wrap twice. Since _git_gitk is always called inside the wrapper, it can call __gitk_main directly. And then, in commit 441ecdab37 (completion: bash: remove old compat wrappers, 2020-10-27) _gitk was removed, which triggers the following error: _git_gitk:9: command not found: _gitk Let's call the correct function: __gitk_main. Cc: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: fix file completion regressionFelipe Contreras2020-12-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Turns out we always need to set the ignored prefix (compset) to have similar behavior as in default Bash. The issue can be seen with: git show master:<tab> Commit 94b2901cfe wrongly removed it. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'fc/bash-completion-alias-of-alias'Junio C Hamano2020-11-261-18/+36
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The command line completion script (in contrib/) learned to expand commands that are alias of alias. * fc/bash-completion-alias-of-alias: completion: bash: improve alias loop detection completion: bash: check for alias loop completion: bash: support recursive aliases
| * | | completion: bash: improve alias loop detectionFelipe Contreras2020-11-171-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is possible for the name of an alias to end with the name of another alias, in which case the code will incorrectly detect a loop. We can fix that by adding an extra space between words. Suggested-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | completion: bash: check for alias loopFelipe Contreras2020-11-101-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't want to be stuck in an endless cycle. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | completion: bash: support recursive aliasesFelipe Contreras2020-11-101-19/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is possible to have recursive aliases like: l = log --oneline lg = l --graph So the completion should detect such aliases as well. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'sd/prompt-local-variable'Junio C Hamano2020-11-111-0/+1
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | Code clean-up. * sd/prompt-local-variable: git-prompt.sh: localize `option` in __git_ps1_show_upstream
| * | | git-prompt.sh: localize `option` in __git_ps1_show_upstreamSibo Dong2020-11-021-0/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The variable 'option' is used in __git_ps1_show_upstream() without being localized. This clobbers the variable the user may be using for other purposes, which is bad. Luckily, $option is not used to carry information around in the script as a global variable. The use of it in this script has very limited scope (namely, only inside this function), so just declare that it is "local". Signed-off-by: Sibo Dong <sibo.dong@outlook.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'fc/zsh-completion'Junio C Hamano2020-11-093-155/+111
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Zsh autocompletion (in contrib/) update. * fc/zsh-completion: (29 commits) zsh: update copyright notices completion: bash: remove old compat wrappers completion: bash: cleanup cygwin check completion: bash: trivial cleanup completion: zsh: add simple version check completion: zsh: trivial simplification completion: zsh: add alias descriptions completion: zsh: improve command tags completion: zsh: refactor command completion completion: zsh: shuffle functions around completion: zsh: simplify file_direct completion: zsh: simplify nl_append completion: zsh: trivial cleanup completion: zsh: simplify direct compadd completion: zsh: simplify compadd functions completion: zsh: fix splitting of words completion: zsh: add missing direct_append completion: fix conflict with bashcomp completion: zsh: fix completion for --no-.. options completion: bash: remove zsh wrapper ...
| * | zsh: update copyright noticesFelipe Contreras2020-10-281-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: bash: remove old compat wrappersFelipe Contreras2020-10-281-12/+0
| | | | | | | | | | | | | | | | | | | | | It's been eight years, more than enough time to move on. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: bash: cleanup cygwin checkFelipe Contreras2020-10-281-2/+2
| | | | | | | | | | | | | | | | | | | | | Avoid Yoda conditions, and use $OSTYPE. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: bash: trivial cleanupFelipe Contreras2020-10-281-7/+6
| | | | | | | | | | | | | | | | | | | | | There's no need to set a variable we are not going to use. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: add simple version checkFelipe Contreras2020-10-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A lot of people are confused about which completion script they are using; Zsh's Git script, or Git's Zsh script. Add a simple helper so they can type 'git zsh<tab>' and find out if they are running the correct one: this. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: trivial simplificationFelipe Contreras2020-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | >From upstream bash simplification: d9ee1e0617 (completion: simplify inner 'case' pattern in __gitcomp()) Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: add alias descriptionsFelipe Contreras2020-10-281-2/+3
| | | | | | | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: improve command tagsFelipe Contreras2020-10-281-4/+7
| | | | | | | | | | | | | | | | | | | | | There's no need to use _alternative and repeat a lot of the code. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: refactor command completionFelipe Contreras2020-10-281-4/+16
| | | | | | | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: shuffle functions aroundFelipe Contreras2020-10-281-12/+12
| | | | | | | | | | | | | | | | | | | | | Just to have a nice order. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: simplify file_directFelipe Contreras2020-10-281-3/+1
| | | | | | | | | | | | | | | | | | | | | It's exactly the same as __gitcomp_file() with no prefix. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: simplify nl_appendFelipe Contreras2020-10-281-4/+1
| | | | | | | | | | | | | | | | | | | | | It's exactly the same as __gitcomp_nl(), no need to duplicate code. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: trivial cleanupFelipe Contreras2020-10-281-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: simplify direct compaddFelipe Contreras2020-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Instead of manually removing the suffix so zsh can add its own, we can tell zsh to add no suffix, so we don't have to remove it. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: simplify compadd functionsFelipe Contreras2020-10-281-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | We don't need to override IFS, zsh has a native way of splitting by new lines: the expansion flag (f). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: fix splitting of wordsFelipe Contreras2020-10-281-2/+1
| | | | | | | | | | | | | | | | | | | | | Files don't need to be split by '=:', words do. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: add missing direct_appendFelipe Contreras2020-10-281-0/+5
| | | | | | | | | | | | | | | | | | | | | Commit 688077910b forgot to add the corresponding zsh function. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: fix conflict with bashcompFelipe Contreras2020-10-281-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | We don't want to override the 'complete()' function in zsh, which can be used by bashcomp. Reported-by: Mark Lodato <lodato@google.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: fix completion for --no-.. optionsFelipe Contreras2020-10-281-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was introduced in upstream's bash script, but never in zsh's: b221b5ab9b (completion: collapse extra --no-.. options) It has been failing since v2.19. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: bash: remove zsh wrapperFelipe Contreras2020-10-281-90/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It has been deprecated for more than eight years now, it's never up to date, and it's a hassle to maintain. It's time to move on. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: bash: synchronize zsh wrapperFelipe Contreras2020-10-281-0/+8
| | | | | | | | | | | | | | | | | | | | | A function was missing. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: fix for command aliasingFelipe Contreras2020-10-281-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A lot of people want to define aliases like gc='git commit', and zsh allows that (when not using 'complete_aliases'), but we need to handle services that call a function other than the main one. With this patch we can do: compdef _git gc=git_commit Additionally, add compatibility for Zsh Git functions which have the form git-commit (with dash, not underscore). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: prompt: fix color for ZshFelipe Contreras2020-10-281-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need PROMPT_COMMAND in Zsh; we are already using %F{color} %f, which in turn use %{ and %}, which are the equivalent of Bash's \[ and \]. We can use as many colors as we want and output directly into PS1 (or RPS1) without the risk of buffer wrapping issues. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: update slave script locationsFelipe Contreras2020-10-281-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Update the default locations of typical system bash-completion, including the default bash-completion location for user scripts, and the recommended way to find the system location (with pkg-config). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: fix for directories with spacesFelipe Contreras2020-10-261-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: reorganize install instructionsFelipe Contreras2020-10-261-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | Start with the most important thing; the proper location of this script, then follow with the location of the slave script (git-completion.bash). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: fix bash script extensionFelipe Contreras2020-10-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 0e5ed7cca3 wrongly changed the extension of the bash script to .zsh; the zstyle configuration is for the slave script (bash), not the master one (zsh). For example it could be: zstyle ':completion:*:*:git:*' script ~/.git-completion.bash The extension doesn't really matter, but it confuses people into thinking it's a zsh script; it's not. Cc: Peter van der Does <peter@avirtualhome.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: fix name due to broken autoloadingFelipe Contreras2020-10-261-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 176f5adfdb wrongly changed the installation path to '~/.zsh/git-completion.zsh', this ensures the script is not automatically loaded. The whole point of adding the script to the fpath variable is that it's autoloaded after typing 'git<tab>', which won't happen unless it's named _git. I've changed the wording so it's crystal clear the name of the file *must* be '_git'. http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Autoloaded-files Cc: Maxim Belsky <public.belsky@gmail.com> Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | completion: zsh: fix __gitcomp_direct()Felipe Contreras2020-10-262-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Many callers append a space suffix, but zsh automatically appends a space, making the completion add two spaces, for example: git log ma<tab> Will complete 'master '. Let's remove that extra space. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>