1 | | --- etc/hub.bash_completion.sh.orig 2013-10-11 17:03:50.000000000 +0200 |
2 | | +++ etc/hub.bash_completion.sh 2013-10-12 14:24:47.000000000 +0200 |
3 | | @@ -1,15 +1,16 @@ |
4 | | # hub tab-completion script for bash. |
5 | | # This script complements the completion script that ships with git. |
6 | | |
7 | | -# Check that git tab completion is available |
8 | | -if declare -F _git > /dev/null; then |
9 | | - # Duplicate and rename the 'list_all_commands' function |
10 | | - eval "$(declare -f __git_list_all_commands | \ |
11 | | - sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')" |
12 | | +# Ensure that git tab completion is available |
13 | | +_xfunc git __git_list_all_commands >/dev/null 2>&1 |
14 | | |
15 | | - # Wrap the 'list_all_commands' function with extra hub commands |
16 | | - __git_list_all_commands() { |
17 | | - cat <<-EOF |
18 | | +# Duplicate and rename the 'list_all_commands' function |
19 | | +eval "$(declare -f __git_list_all_commands | \ |
20 | | + sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')" |
21 | | + |
22 | | +# Wrap the 'list_all_commands' function with extra hub commands |
23 | | +__git_list_all_commands() { |
24 | | +cat <<-EOF |
25 | | alias |
26 | | pull-request |
27 | | fork |
28 | | @@ -17,9 +18,11 @@ |
29 | | browse |
30 | | compare |
31 | | EOF |
32 | | - __git_list_all_commands_without_hub |
33 | | - } |
34 | | +__git_list_all_commands_without_hub |
35 | | +} |
36 | | |
37 | | - # Ensure cached commands are cleared |
38 | | - __git_all_commands="" |
39 | | -fi |
40 | | +# Ensure cached commands are cleared |
41 | | +__git_all_commands="" |
42 | | + |
43 | | +# Register completion for the hub command |
44 | | +__git_complete hub __git_main |