From: Lars Hjemli <hjemli@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 3/6] git-merge: refactor option parsing
Date: Mon, 24 Sep 2007 00:51:42 +0200 [thread overview]
Message-ID: <1190587905-700-4-git-send-email-hjemli@gmail.com> (raw)
In-Reply-To: <1190587905-700-3-git-send-email-hjemli@gmail.com>
Move the option parsing into a separate function as preparation for reuse
by the next commit.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
git-merge.sh | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/git-merge.sh b/git-merge.sh
index 3857634..68b3503 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
next prev parent reply other threads:[~2007-09-23 22:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-23 22:51 [PATCH 0/6] per branch options for git-merge Lars Hjemli
2007-09-23 22:51 ` [PATCH 1/6] Add test-script for git-merge porcelain Lars Hjemli
2007-09-23 22:51 ` [PATCH 2/6] git-merge: fix faulty SQUASH_MSG Lars Hjemli
2007-09-23 22:51 ` Lars Hjemli [this message]
2007-09-23 22:51 ` [PATCH 4/6] git-merge: add support for branch.<name>.mergeoptions Lars Hjemli
2007-09-23 22:51 ` [PATCH 5/6] git-merge: add support for --commit and --no-squash Lars Hjemli
2007-09-23 22:51 ` [PATCH 6/6] git-merge: add --ff and --no-ff options Lars Hjemli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1190587905-700-4-git-send-email-hjemli@gmail.com \
--to=hjemli@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).