submodule: teach set-branch subcommand

This teaches git-submodule the set-branch subcommand which allows the
branch of a submodule to be set through a porcelain command without
having to manually manipulate the .gitmodules file.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Denton Liu
2019-02-08 03:21:34 -08:00
committed by Junio C Hamano
parent c89c494240
commit b57e8119e6
4 changed files with 175 additions and 5 deletions

View File

@ -2573,7 +2573,7 @@ _git_submodule ()
{
__git_has_doubledash && return
local subcommands="add status init deinit update summary foreach sync"
local subcommands="add status init deinit update set-branch summary foreach sync"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
case "$cur" in
@ -2604,6 +2604,9 @@ _git_submodule ()
--force --rebase --merge --reference --depth --recursive --jobs
"
;;
set-branch,--*)
__gitcomp "--default --branch"
;;
summary,--*)
__gitcomp "--cached --files --summary-limit"
;;