completion: teach --recurse-submodules to fetch, pull and push

Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sup Yut Sum committed Feb 9, 2014 at 22:35 UTC 4dd5c4709a51bb704c2c7fb59170b494b76daab9
1 file changed +18 -1
contrib/completion/git-completion.bash
+18 -1
@@ -1221,14 +1221,20 @@ _git_difftool ()
1221 __git_complete_revlist_file
1222 }
1223
1224 +__git_fetch_recurse_submodules="yes on-demand no"
1225 +
1226 __git_fetch_options="
1227 --quiet --verbose --append --upload-pack --force --keep --depth=
1226 - --tags --no-tags --all --prune --dry-run
1228 + --tags --no-tags --all --prune --dry-run --recurse-submodules=
1229 "
1230
1231 _git_fetch ()
1232 {
1233 case "$cur" in
1234 + --recurse-submodules=*)
1235 + __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"
1236 + return
1237 + ;;
1238 --*)
1239 __gitcomp "$__git_fetch_options"
1240 return
@@ -1577,6 +1583,10 @@ _git_pull ()
1583 __git_complete_strategy && return
1584
1585 case "$cur" in
1586 + --recurse-submodules=*)
1587 + __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"
1588 + return
1589 + ;;
1590 --*)
1591 __gitcomp "
1592 --rebase --no-rebase
@@ -1589,6 +1599,8 @@ _git_pull ()
1599 __git_complete_remote_or_refspec
1600 }
1601
1602 +__git_push_recurse_submodules="check on-demand"
1603 +
1604 _git_push ()
1605 {
1606 case "$prev" in
@@ -1601,10 +1613,15 @@ _git_push ()
1613 __gitcomp_nl "$(__git_remotes)" "" "${cur##--repo=}"
1614 return
1615 ;;
1616 + --recurse-submodules=*)
1617 + __gitcomp "$__git_push_recurse_submodules" "" "${cur##--recurse-submodules=}"
1618 + return
1619 + ;;
1620 --*)
1621 __gitcomp "
1622 --all --mirror --tags --dry-run --force --verbose
1623 --receive-pack= --repo= --set-upstream
1624 + --recurse-submodules=
1625 "
1626 return
1627 ;;