git-merge: refactor option parsing
Move the option parsing into a separate function as preparation for reuse by the next commit. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
2ae4fd7695
commit
d38eb710d9
20
git-merge.sh
20
git-merge.sh
@ -119,11 +119,7 @@ merge_name () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$#" in 0) usage ;; esac
|
parse_option () {
|
||||||
|
|
||||||
have_message=
|
|
||||||
while test $# != 0
|
|
||||||
do
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\
|
-n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\
|
||||||
--no-summa|--no-summar|--no-summary)
|
--no-summa|--no-summar|--no-summary)
|
||||||
@ -166,9 +162,21 @@ do
|
|||||||
have_message=t
|
have_message=t
|
||||||
;;
|
;;
|
||||||
-*) usage ;;
|
-*) usage ;;
|
||||||
*) break ;;
|
*) return 1 ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
|
args_left=$#
|
||||||
|
}
|
||||||
|
|
||||||
|
test $# != 0 || usage
|
||||||
|
|
||||||
|
have_message=
|
||||||
|
while parse_option "$@"
|
||||||
|
do
|
||||||
|
while test $args_left -lt $#
|
||||||
|
do
|
||||||
|
shift
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
if test -z "$show_diffstat"; then
|
if test -z "$show_diffstat"; then
|
||||||
|
Loading…
Reference in New Issue
Block a user