Skip to content

Commit 42b30bc

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e94fb44 commit 42b30bc

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

contrib/completion/git-completion.bash

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,44 +3035,45 @@ _git_stash ()
30353035
fi
30363036
;;
30373037
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
30693066
__gitcomp_nl "$(__git stash list \
30703067
| 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
30763077
}
30773078

30783079
_git_submodule ()

0 commit comments

Comments
 (0)