git-completion.bash: extract from else in _git_stash()

To save a level of indentation, perform an early return in the "if" arm
so we can move the "else" code out of the block.

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 2021-03-24 01:36:28 -07:00 коммит произвёл Junio C Hamano
Родитель e94fb44042
Коммит 42b30bcbb7
1 изменённых файлов: 37 добавлений и 36 удалений

Просмотреть файл

@ -3035,44 +3035,45 @@ _git_stash ()
fi fi
;; ;;
esac esac
else return
case "$subcommand,$cur" in fi
push,--*)
__gitcomp "$save_opts --message" case "$subcommand,$cur" in
;; push,--*)
save,--*) __gitcomp "$save_opts --message"
__gitcomp "$save_opts" ;;
;; save,--*)
apply,--*|pop,--*) __gitcomp "$save_opts"
__gitcomp "--index --quiet" ;;
;; apply,--*|pop,--*)
drop,--*) __gitcomp "--index --quiet"
__gitcomp "--quiet" ;;
;; drop,--*)
list,--*) __gitcomp "--quiet"
__gitcomp "--name-status --oneline --patch-with-stat" ;;
;; list,--*)
show,--*) __gitcomp "--name-status --oneline --patch-with-stat"
__gitcomp "$__git_diff_common_options" ;;
;; show,--*)
branch,--*) __gitcomp "$__git_diff_common_options"
;; ;;
branch,*) branch,--*)
if [ $cword -eq $((__git_subcommand_idx+2)) ]; then ;;
__git_complete_refs branch,*)
else if [ $cword -eq $((__git_subcommand_idx+2)) ]; then
__gitcomp_nl "$(__git stash list \ __git_complete_refs
| sed -n -e 's/:.*//p')" else
fi
;;
show,*|apply,*|drop,*|pop,*)
__gitcomp_nl "$(__git stash list \ __gitcomp_nl "$(__git stash list \
| sed -n -e 's/:.*//p')" | sed -n -e 's/:.*//p')"
;; fi
*) ;;
;; show,*|apply,*|drop,*|pop,*)
esac __gitcomp_nl "$(__git stash list \
fi | sed -n -e 's/:.*//p')"
;;
*)
;;
esac
} }
_git_submodule () _git_submodule ()