|
31 | 31 | # Note that "git" is optional --- '!f() { : commit; ...}; f' would complete
|
32 | 32 | # just like the 'git commit' command.
|
33 | 33 | #
|
34 |
| -# If you have a command that is not part of git, but you would still |
35 |
| -# like completion, you can use __git_complete: |
| 34 | +# To add completion for git subcommands that are implemented in external |
| 35 | +# scripts, define a function of the form '_git_${subcommand}' while replacing |
| 36 | +# all dashes with underscores, and the main git completion will make use of it. |
| 37 | +# For example, to add completion for 'git do-stuff' (which could e.g. live |
| 38 | +# in /usr/bin/git-do-stuff), name the completion function '_git_do_stuff'. |
| 39 | +# See _git_show, _git_bisect etc. below for more examples. |
| 40 | +# |
| 41 | +# If you have a shell command that is not part of git (and is not called as a |
| 42 | +# git subcommand), but you would still like git-style completion for it, use |
| 43 | +# __git_complete. For example, to use the same completion as for 'git log' also |
| 44 | +# for the 'gl' command: |
36 | 45 | #
|
37 | 46 | # __git_complete gl git_log
|
38 | 47 | #
|
39 |
| -# Or if it's a main command (i.e. git or gitk): |
| 48 | +# Or if the 'gk' command should be completed the same as 'gitk': |
40 | 49 | #
|
41 | 50 | # __git_complete gk gitk
|
42 | 51 | #
|
| 52 | +# The second parameter of __git_complete gives the completion function; it is |
| 53 | +# resolved as a function named "$2", or "__$2_main", or "_$2" in that order. |
| 54 | +# In the examples above, the actual functions used for completion will be |
| 55 | +# _git_log and __gitk_main. |
| 56 | +# |
43 | 57 | # Compatible with bash 3.2.57.
|
44 | 58 | #
|
45 | 59 | # You can set the following environment variables to influence the behavior of
|
@@ -3581,6 +3595,17 @@ _git_svn ()
|
3581 | 3595 | fi
|
3582 | 3596 | }
|
3583 | 3597 |
|
| 3598 | +_git_symbolic_ref () { |
| 3599 | + case "$cur" in |
| 3600 | + --*) |
| 3601 | + __gitcomp_builtin symbolic-ref |
| 3602 | + return |
| 3603 | + ;; |
| 3604 | + esac |
| 3605 | + |
| 3606 | + __git_complete_refs |
| 3607 | +} |
| 3608 | + |
3584 | 3609 | _git_tag ()
|
3585 | 3610 | {
|
3586 | 3611 | local i c="$__git_cmd_idx" f=0
|
|
0 commit comments