aboutsummaryrefslogtreecommitdiff
path: root/contrib/completion
Commit message (Collapse)AuthorAge
* Merge branch 'fc/git-complete-helper-fix'Junio C Hamano2012-06-13
|\ | | | | | | | | * fc/git-complete-helper-fix: completion: put main git and gitk completion functions back into git namespace
| * completion: put main git and gitk completion functions back into git namespaceSZEDER Gábor2012-06-13
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit 7f02f3d7 (completion: rename internal helpers _git and _gitk, 2012-05-19) renamed said functions to _main_git() and _main_gitk(), respectively. By convention the name of our git-completion-specific functions start with '_git' or '__git' prefix, so rename those functions once again to put them back into our "namespace". Use the two underscore prefix, because _git_main() could be mistaken for the completion function of the (not yet existing) 'git main' command. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | completion: remove credential helpers from porcelain commandsSZEDER Gábor2012-06-13
| | | | | | | | | | Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'fc/git-complete-helper-fix'Junio C Hamano2012-05-25
|\ \ | |/ | | | | Resurrects old behaviour of _git/_gitk for external users.
| * completion: add support for backwards compatibilityFelipe Contreras2012-05-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some people might be relying on _git and _gitk to define custom aliases, unfortunately, commit 6b179ad (completion: add new __git_complete helper) broke that support. "bash: [: 1: unary operator expected" This can be easily fixed by using __git_complete, but it's not meant to be public. Although _git and _gitk are probably not meant to be public, it's easy to keep having support for them by having a wrapper to the proper new function that is fully functional. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * completion: rename internal helpers _git and _gitkFelipe Contreras2012-05-20
| | | | | | | | | | | | | | | | Would be useful to provide backwards compatibility for _git. Also, zsh completion uses _git, and it cannot be changed. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'fc/git-complete-helper'Junio C Hamano2012-05-17
|\ \ | |/ | | | | | | | | By Felipe Contreras * fc/git-complete-helper: completion: add new __git_complete helper
| * completion: add new __git_complete helperFelipe Contreras2012-05-14
| | | | | | | | | | | | | | | | This simplifies the completions, and would make it easier to define aliases in the future. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'fc/simplify-complete-revlist-file'Junio C Hamano2012-05-14
|\ \ | |/ |/| | | | | | | By Felipe Contreras * fc/simplify-complete-revlist-file: completion: simplify __git_complete_revlist_file
| * completion: simplify __git_complete_revlist_fileFelipe Contreras2012-05-07
| | | | | | | | | | | | | | | | | | Use new __gitcomp_nl; this is the last place that uses COMPREPLY and compgen directly outside __gitcomp* functions. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Acked-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | completion: fix completion after 'git --option <TAB>'SZEDER Gábor2012-04-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bash completion doesn't work when certain options to git itself are specified, e.g. 'git --no-pager <TAB>' errors out with error: invalid key: alias.--no-pager The main _git() completion function finds out the git command name by looping through all the words on the command line and searching for the first word that is not a known option for the git command. Unfortunately the list of known git options was not updated in a long time, and newer options are not skipped but mistaken for a git command. Such a misrecognized "command" is then passed to __git_aliased_command(), which in turn passes it to a 'git config' query, hence the error. Currently the following options are misrecognized for a git command: -c --no-pager --exec-path --html-path --man-path --info-path --no-replace-objects --work-tree= --namespace= To fix this we could just update the list of options to be skipped, but the same issue will likely arise, if the git command learns a new option in the future. Therefore, to make it more future proof against new options, this patch changes that loop to skip all option-looking words, i.e. words starting with a dash. We also have to handle the '-c' option specially, because it takes a configutation parameter in a separate word, which must be skipped, too. [fc: added tests] Signed-off-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>
* | completion: avoid trailing space for --exec-pathJonathan Nieder2012-04-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "--exec-path" looks to the completion script like an unambiguous successful completion, but it is wrong to emit a SP after it as if declaring that we are done with completion; the user could be trying to do git --exec-path; # print name of helper directory or git --exec-path=/path/to/alternative/helper/dir <subcommand> so the most helpful thing to do is to leave out the trailing space and leave it to the operator to type an equal sign or carriage return according to the situation. [fc: added tests] Cc: Andreas Schwab <schwab@linux-m68k.org> Reported-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | completion: add missing general optionsFelipe Contreras2012-04-21
| | | | | | | | | | | | | | And add relevant tests. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | completion: simplify by using $prevFelipe Contreras2012-04-21
| | | | | | | | | | | | | | cword-1 is the previous word ($prev). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | completion: simplify __gitcomp_1Felipe Contreras2012-04-21
|/ | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'am/completion-zsh-fix'Junio C Hamano2012-03-23
|\ | | | | | | | | * am/completion-zsh-fix: contrib/completion: "local var=()" is misinterpreted as func-decl by zsh
| * contrib/completion: "local var=()" is misinterpreted as func-decl by zshAlex Merry2012-03-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain versions of zsh seems to treat local var=() as a function declaration, rather than an assignment of an empty array, although its documentation does not suggest that this should be the case. With zsh 4.3.15 on Fedora Core 15, this causes __git_ps1 " (%s)" to trigger an error message: local:2: command not found: svn_url_pattern when GIT_PS1_SHOWUPSTREAM="auto". Signed-off-by: Alex Merry <dev@randomguy3.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'zj/diff-stat-dyncol'Junio C Hamano2012-03-06
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By Zbigniew Jędrzejewski-Szmek (8) and Junio C Hamano (1) * zj/diff-stat-dyncol: : This breaks tests. Perhaps it is not worth using the decimal-width stuff : for this series, at least initially. diff --stat: add config option to limit graph width diff --stat: enable limiting of the graph part diff --stat: add a test for output with COLUMNS=40 diff --stat: use a maximum of 5/8 for the filename part merge --stat: use the full terminal width log --stat: use the full terminal width show --stat: use the full terminal width diff --stat: use the full terminal width diff --stat: tests for long filenames and big change counts
| * | diff --stat: add config option to limit graph widthZbigniew Jędrzejewski-Szmek2012-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Config option diff.statGraphWidth=<width> is equivalent to --stat-graph-width=<width>, except that the config option is ignored by format-patch. For the graph-width limiting to be usable, it should happen 'automatically' once configured, hence the config option. Nevertheless, graph width limiting only makes sense when used on a wide terminal, so it should not influence the output of format-patch, which adheres to the 80-column standard. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'pj/completion-remote-set-url-branches'Junio C Hamano2012-02-28
|\ \ \ | | | | | | | | | | | | | | | | | | | | * pj/completion-remote-set-url-branches: completion: normalize increment/decrement style completion: remote set-* <name> and <branch>
| * | | completion: normalize increment/decrement stylePhilip Jägenstedt2012-02-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The style used for incrementing and decrementing variables was fairly inconsistenty and was normalized to use x++, or ((x++)) in contexts where the former would otherwise be interpreted as a command. This is a bash-ism, but for obvious reasons this script is already bash-specific. Signed-off-by: Philip Jägenstedt <philip@foolip.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | completion: remote set-* <name> and <branch>Philip Jägenstedt2012-02-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Complete <name> only for set-url. For set-branches and set-head, complete <name> and <branch> over the network, like e.g. git pull already does. Signed-off-by: Philip Jägenstedt <philip@foolip.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Sync with 1.7.9.2Junio C Hamano2012-02-22
|\ \ \ \ | |/ / / | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | completion: use tabs for indentationPhilip Jägenstedt2012-02-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CodingGuidlines confidently declares "We use tabs for indentation." It would be a shame if it were caught lying. Signed-off-by: Philip Jägenstedt <philip@foolip.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | completion: remove stale "to submit patches" documentationPhilip Jägenstedt2012-02-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was out-of-sync with the reality of who works on this script. Defer (silently) to Documentation/SubmittingPatches like all other code. Signed-off-by: Philip Jägenstedt <philip@foolip.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'master' of git://bogomips.org/git-svnJunio C Hamano2012-02-21
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'master' of git://bogomips.org/git-svn: git-svn.perl: fix a false-positive in the "already exists" test git-svn.perl: perform deletions before anything else git-svn: Fix time zone in --localtime git-svn: un-break "git svn rebase" when log.abbrevCommit=true git-svn: remove redundant porcelain option to rev-list completion: add --interactive option to git svn dcommit
| * | | completion: add --interactive option to git svn dcommitFrederic Heitzmann2012-02-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | see afd7f1e for more details on git svn dcommit --interactive Signed-off-by: Frederic Heitzmann <frederic.heitzmann@gmail.com> Acked-by: Eric Wong <normalperson@yhbt.net>
| * | | Sync with maintJunio C Hamano2012-02-16
| |\ \ \ | | |_|/ | |/| |
| * | | Merge branch 'fc/zsh-completion'Junio C Hamano2012-02-12
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fc/zsh-completion: completion: simplify __gitcomp and __gitcomp_nl implementations completion: use ls -1 instead of rolling a loop to do that ourselves completion: work around zsh option propagation bug
| * \ \ \ Merge branch 'rt/completion-branch-edit-desc'Junio C Hamano2012-02-07
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * rt/completion-branch-edit-desc: completion: --edit-description option for git-branch
| * | | | | completion: --edit and --no-edit for git-mergeAdrian Weimann2012-01-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Adrian Weimann <adrian.weimann@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | Merge branch 'fc/zsh-completion' into maintJunio C Hamano2012-02-21
|\ \ \ \ \ \ | | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | * fc/zsh-completion: completion: simplify __gitcomp and __gitcomp_nl implementations completion: use ls -1 instead of rolling a loop to do that ourselves completion: work around zsh option propagation bug
| * | | | | completion: simplify __gitcomp and __gitcomp_nl implementationsFelipe Contreras2012-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These shell functions are written in an unnecessarily verbose way; simplify their "conditionally use $<number> after checking $# against <number>" logic by using shell's built-in conditional substitution facilities. Also remove the first of the two assignments to IFS in __gitcomp_nl that does not have any effect. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | completion: use ls -1 instead of rolling a loop to do that ourselvesFelipe Contreras2012-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies the code a great deal. In particular, it allows us to get rid of __git_shopt, which is used only in this fuction to enable 'nullglob' in zsh. [jn: squashed with a patch that actually gets rid of __git_shopt] Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | completion: work around zsh option propagation bugFelipe Contreras2012-02-06
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When listing commands in zsh (git <TAB><TAB>), all of them will show up, instead of only porcelain ones. The root cause of this is because zsh versions from 4.3.0 to present (4.3.15) do not correctly propagate the SH_WORD_SPLIT option into the subshell in ${foo:=$(bar)} expressions. Because of this bug, the list of all commands was treated as a single word in __git_list_porcelain_commands and did not match any of the patterns that would usually cause plumbing to be excluded. With problematic versions of zsh, after running emulate sh fn () { var='one two' for v in $var; do echo $v; done } x=$(fn) : ${y=$(fn)} printing "$x" results in two lines as expected, but printing "$y" results in a single line because $var is expanded as a single word when evaluating fn to compute y. So avoid the construct, and use an explicit 'test -n "$foo" || foo=$(bar)' instead. [jn: clarified commit message, indentation style fix] Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | completion: Allow dash as the first character for __git_ps1Christian Hammerl2012-02-21
| |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the argument for `__git_ps1` begins with a dash, `printf` tries to interpret it as an option which results in an error message. The problem is solved by adding '--' before the argument to tell `printf` to not interpret the following argument as an option. Adding '--' directly to the argument does not help because the argument is enclosed by double quotes. Signed-off-by: Christian Hammerl <info@christian-hammerl.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | completion: --list option for git-branchRalf Thielow2012-02-16
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Ralf Thielow <ralf.thielow@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'rt/completion-branch-edit-desc' into maintJunio C Hamano2012-02-16
|\ \ \ \ | | |/ / | |/| / | |_|/ |/| | * rt/completion-branch-edit-desc: completion: --edit-description option for git-branch
| * | completion: --edit-description option for git-branchRalf Thielow2012-01-29
| |/ | | | | | | | | Signed-off-by: Ralf Thielow <ralf.thielow@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | completion: --edit and --no-edit for git-mergeAdrian Weimann2012-02-06
|/ | | | | Signed-off-by: Adrian Weimann <adrian.weimann@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-completion: workaround zsh COMPREPLY bugFelipe Contreras2012-01-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | zsh adds a backslash (foo\ ) for each item in the COMPREPLY array if IFS doesn't contain spaces. This issue has been reported[1], but there is no solution yet. This wasn't a problem due to another bug[2], which was fixed in zsh version 4.3.12. After this change, 'git checkout ma<tab>' would resolve to 'git checkout master\ '. Aditionally, the introduction of __gitcomp_nl in commit a31e626 (completion: optimize refs completion) in git also made the problem apparent, as Matthieu Moy reported. The simplest and most generic solution is to hide all the changes we do to IFS, so that "foo \nbar " is recognized by zsh as "foo bar". This works on versions of git before and after the introduction of __gitcomp_nl (a31e626), and versions of zsh before and after 4.3.12. Once zsh is fixed, we should conditionally disable this workaround to have the same benefits as bash users. [1] http://www.zsh.org/mla/workers/2012/msg00053.html [2] http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=commitdiff;h=2e25dfb8fd38dbef0a306282ffab1d343ce3ad8d Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* bash completion: use read -r everywhereThomas Rast2011-12-21
| | | | | | | | | | | | | | | | | | | | We use the 'read' command without -r, so that it treats '\' as an escape character, in several places. This breaks the loop reading refnames from git-for-each-ref in __git_refs() if there are refnames such as "foo'bar", in which case for-each-ref helpfully quotes them as $ git update-ref "refs/remotes/test/foo'bar" HEAD $ git for-each-ref --shell --format="ref=%(refname:short)" "refs/remotes" ref='test/foo'\''bar' Interpolating the \' here will read "ref='test/foo'''bar'" instead, and eval then chokes on the unbalanced quotes. However, since none of the read loops _want_ to have backslashes interpolated, it's much safer to use read -r everywhere. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'sg/complete-refs'Junio C Hamano2011-12-09
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sg/complete-refs: completion: remove broken dead code from __git_heads() and __git_tags() completion: fast initial completion for config 'remote.*.fetch' value completion: improve ls-remote output filtering in __git_refs_remotes() completion: query only refs/heads/ in __git_refs_remotes() completion: support full refs from remote repositories completion: improve ls-remote output filtering in __git_refs() completion: make refs completion consistent for local and remote repos completion: optimize refs completion completion: document __gitcomp() Conflicts: contrib/completion/git-completion.bash
| * completion: remove broken dead code from __git_heads() and __git_tags()SZEDER Gábor2011-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __git_heads() was introduced in 5de40f5 (Teach bash about git-repo-config., 2006-11-27), and __git_tags() in 88e21dc (Teach bash about completing arguments for git-tag, 2007-08-31). As their name suggests, __git_heads() is supposed to list only branches, and __git_tags() only tags. Since their introduction both of these functions consist of two distinct parts. The first part gets branches or tags, respectively, from a local repositoty using 'git for-each-ref'. The second part queries a remote repository given as argument using 'git ls-remote'. These remote-querying parts are broken in both functions since their introduction, because they list both branches and tags from the remote repository. (The 'git ls-remote' query is not limited to list only heads or tags, respectively, and the for loop filtering the query results prints everything except dereferenced tags.) This breakage could be easily fixed by passing the '--heads' or '--tags' options or appropriate refs patterns to the 'git ls-remote' invocations. However, that no one noticed this breakage yet is probably not a coincidence: neither of these two functions were used to query a remote repository, the remote-querying parts were dead code already upon thier introduction and remained dead ever since. Since those parts of code are broken, are and were never used, stop the bit-rotting and remove them. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * completion: fast initial completion for config 'remote.*.fetch' valueSZEDER Gábor2011-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refspecs for branches in a remote repository start with 'refs/heads/', so completing those refspecs with 'git config remote.origin.fetch <TAB>' always offers 'refs/heads/' first, because that's the unique part of the possible refspecs. But it does so only after querying the remote with 'git ls-remote', which can take a while when the request goes through some slower network to a remote server. Don't waste the user's time and offer 'refs/heads/' right away for 'git config remote.origin.fetch <TAB>'. The reason for putting 'refs/heads/' directly into COMPREPLY instead of using __gitcomp() is to avoid __gitcomp() adding a trailing space. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * completion: improve ls-remote output filtering in __git_refs_remotes()SZEDER Gábor2011-10-21
| | | | | | | | | | | | | | | | | | This follows suit of a previous patch for __git_refs(): use a while-read loop and let bash's word splitting get rid of object names from 'git ls-remote's output. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * completion: query only refs/heads/ in __git_refs_remotes()SZEDER Gábor2011-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __git_refs_remotes() is used to provide completion for refspecs to set 'remote.*.fetch' config variables for branches on the given remote. So it's really only interested in refs under 'refs/heads/', but it queries the remote for all its refs and then filters out all refs outside of 'refs/heads/'. Let 'git ls-remote' do the filtering. Also remove the unused $cmd variable from __git_refs_remotes(). Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * completion: support full refs from remote repositoriesSZEDER Gábor2011-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When the __git_refs() completion helper function lists refs from a local repository, it usually lists the refs' short name, except when it needs to provide completion for words starting with refs, because in that case it lists full ref names, see 608efb87 (bash: complete full refs, 2008-11-28). Add the same functionality to the code path dealing with remote repositories, too. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * completion: improve ls-remote output filtering in __git_refs()SZEDER Gábor2011-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The remote-handling part of __git_refs() has a nice for loop and state machine case statement to iterate over all words from the output of 'git ls-remote' to identify object names and ref names. Since each line in the output of 'git ls-remote' consists of an object name and a ref name, we can do more effective filtering by using a while-read loop and letting bash's word splitting take care of object names. This way the code is easier to understand and the loop will need only half the number of iterations than before. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * completion: make refs completion consistent for local and remote reposSZEDER Gábor2011-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For a local repository the __git_refs() completion helper function lists refs under 'refs/(tags|heads|remotes)/', plus some special refs like HEAD and ORIG_HEAD. For a remote repository, however, it lists all refs. Fix this inconsistency by specifying refs filter patterns for 'git ls-remote' to only list refs under 'refs/(tags|heads|remotes)/'. For now this makes it impossible to complete refs outside of 'refs/(tags|heads|remotes)/' in a remote repository, but a followup patch will resurrect that. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>