summaryrefslogtreecommitdiff
path: root/git-merge.sh
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2007-09-23 22:51:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-24 00:14:03 (GMT)
commitd38eb710d92864b0b1f7cd36f17e273e3d8c735c (patch)
tree4c92295173e9afab8eca87ce321fc0dc40e5a669 /git-merge.sh
parent2ae4fd7695abcf2ab36f3fe984cc4ca44559635f (diff)
downloadgit-d38eb710d92864b0b1f7cd36f17e273e3d8c735c.zip
git-d38eb710d92864b0b1f7cd36f17e273e3d8c735c.tar.gz
git-d38eb710d92864b0b1f7cd36f17e273e3d8c735c.tar.bz2
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>
Diffstat (limited to 'git-merge.sh')
-rwxr-xr-xgit-merge.sh20
1 files changed, 14 insertions, 6 deletions
diff --git a/git-merge.sh b/git-merge.sh
index 919e6be..49185eb 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -119,11 +119,7 @@ merge_name () {
fi
}
-case "$#" in 0) usage ;; esac
-
-have_message=
-while test $# != 0
-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=$#
+}
+
+test $# != 0 || usage
+
+have_message=
+while parse_option "$@"
+do
+ while test $args_left -lt $#
+ do
+ shift
+ done
done
if test -z "$show_diffstat"; then