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>

Denton Liu committed Mar 24, 2021 at 01:36 UTC 42b30bcbb7929527631225a89a5630057535d766
1 file changed +37 -36
contrib/completion/git-completion.bash
+37 -36
@@ -3035,44 +3035,45 @@ _git_stash ()
3035 fi
3036 ;;
3037 esac
3038 - else
3039 - case "$subcommand,$cur" in
3040 - push,--*)
3041 - __gitcomp "$save_opts --message"
3042 - ;;
3043 - save,--*)
3044 - __gitcomp "$save_opts"
3045 - ;;
3046 - apply,--*|pop,--*)
3047 - __gitcomp "--index --quiet"
3048 - ;;
3049 - drop,--*)
3050 - __gitcomp "--quiet"
3051 - ;;
3052 - list,--*)
3053 - __gitcomp "--name-status --oneline --patch-with-stat"
3054 - ;;
3055 - show,--*)
3056 - __gitcomp "$__git_diff_common_options"
3057 - ;;
3058 - branch,--*)
3059 - ;;
3060 - branch,*)
3061 - if [ $cword -eq $((__git_subcommand_idx+2)) ]; then
3062 - __git_complete_refs
3063 - else
3064 - __gitcomp_nl "$(__git stash list \
3065 - | sed -n -e 's/:.*//p')"
3066 - fi
3067 - ;;
3068 - show,*|apply,*|drop,*|pop,*)
3038 + return
3039 + fi
3040 +
3041 + case "$subcommand,$cur" in
3042 + push,--*)
3043 + __gitcomp "$save_opts --message"
3044 + ;;
3045 + save,--*)
3046 + __gitcomp "$save_opts"
3047 + ;;
3048 + apply,--*|pop,--*)
3049 + __gitcomp "--index --quiet"
3050 + ;;
3051 + drop,--*)
3052 + __gitcomp "--quiet"
3053 + ;;
3054 + list,--*)
3055 + __gitcomp "--name-status --oneline --patch-with-stat"
3056 + ;;
3057 + show,--*)
3058 + __gitcomp "$__git_diff_common_options"
3059 + ;;
3060 + branch,--*)
3061 + ;;
3062 + branch,*)
3063 + if [ $cword -eq $((__git_subcommand_idx+2)) ]; then
3064 + __git_complete_refs
3065 + else
3066 __gitcomp_nl "$(__git stash list \
3067 | sed -n -e 's/:.*//p')"
3071 - ;;
3072 - *)
3073 - ;;
3074 - esac
3075 - fi
3068 + fi
3069 + ;;
3070 + show,*|apply,*|drop,*|pop,*)
3071 + __gitcomp_nl "$(__git stash list \
3072 + | sed -n -e 's/:.*//p')"
3073 + ;;
3074 + *)
3075 + ;;
3076 + esac
3077 }
3078
3079 _git_submodule ()