Move the option parsing into a separate function as preparation for reuse by the next commit. Signed-off-by: Lars Hjemli <hjemli@xxxxxxxxx> --- git-merge.sh | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/git-merge.sh b/git-merge.sh index 3a01db0..a3ef676 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -119,11 +119,7 @@ merge_name () { fi } -case "$#" in 0) usage ;; esac - -have_message= -while case "$#" in 0) break ;; esac -do +parse_option () { case "$1" in -n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\ --no-summa|--no-summar|--no-summary) @@ -166,9 +162,21 @@ do have_message=t ;; -*) usage ;; - *) break ;; + *) return 1 ;; esac shift + args_left="$#" +} + +case "$#" in 0) usage ;; esac + +have_message= +while parse_option "$@" +do + while test $args_left -lt $# + do + shift + done done if test -z "$show_diffstat"; then -- 1.5.3.2.82.g75c8d - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html