Skip to content

Commit

Permalink
git-completion.bash: extract from else in _git_stash()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Denton-L authored and gitster committed Mar 24, 2021
1 parent e94fb44 commit 42b30bc
Showing 1 changed file with 37 additions and 36 deletions.
73 changes: 37 additions & 36 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3035,44 +3035,45 @@ _git_stash ()
fi
;;
esac
else
case "$subcommand,$cur" in
push,--*)
__gitcomp "$save_opts --message"
;;
save,--*)
__gitcomp "$save_opts"
;;
apply,--*|pop,--*)
__gitcomp "--index --quiet"
;;
drop,--*)
__gitcomp "--quiet"
;;
list,--*)
__gitcomp "--name-status --oneline --patch-with-stat"
;;
show,--*)
__gitcomp "$__git_diff_common_options"
;;
branch,--*)
;;
branch,*)
if [ $cword -eq $((__git_subcommand_idx+2)) ]; then
__git_complete_refs
else
__gitcomp_nl "$(__git stash list \
| sed -n -e 's/:.*//p')"
fi
;;
show,*|apply,*|drop,*|pop,*)
return
fi

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

_git_submodule ()
Expand Down

0 comments on commit 42b30bc

Please sign in to comment.