git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: Petr Baudis <pasky@ucw.cz>
Cc: git@vger.kernel.org
Subject: [PATCH Cogito] cg-log: improve parsing -r
Date: Sun, 29 May 2005 03:41:38 +0200	[thread overview]
Message-ID: <20050529014138.GB7520@diku.dk> (raw)

Move parsing of the -r option to the option parsing loop so it no longer
needs to be last in the argument list.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---

 cg-log |   32 +++++++++++++++-----------------
 1 files changed, 15 insertions(+), 17 deletions(-)

--- c8e987e5e4608c1144293cd3f852210d70b572cb/cg-log  (mode:100755)
+++ uncommitted/cg-log  (mode:100755)
@@ -37,7 +37,10 @@
 colsignoff=
 coldefault=
 list_files=
+log_start=
+log_end=
 user=
+
 while [ "$1" ]; do
 	# TODO: Parse -r here too.
 	case "$1" in
@@ -59,6 +62,18 @@
 		user="${1#-u}"
 		shift
 		;;
+	-r)
+		shift
+		if echo "$1" | grep -q ':'; then
+			log_end=$(echo "$1" | cut -d : -f 2)
+			log_start=$(echo "$1" | cut -d : -f 1)
+		elif [ -z "$log_start" ]; then
+			log_start="$1"
+		else
+			log_end="$1"
+		fi
+		shift
+		;;
 	*)
 		break
 		;;
@@ -93,23 +108,6 @@
 	echo "$coldefault:"
 }
 
-log_start=
-log_end=
-if [ "$1" = "-r" ]; then
-	shift
-	log_start="$1"
-	shift
-	if echo "$log_start" | grep -q ':'; then
-		log_end=$(echo "$log_start" | cut -d : -f 2)
-		log_start=$(echo "$log_start" | cut -d : -f 1)
-	fi
-fi
-if [ "$1" = "-r" ]; then
-	shift
-	log_end="$1"
-	shift
-fi
-
 if [ "$log_end" ]; then
 	id1="$(commit-id $log_start)" || exit 1
 	id2="$(commit-id $log_end)" || exit 1
-- 
Jonas Fonseca

                 reply	other threads:[~2005-05-29  1:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050529014138.GB7520@diku.dk \
    --to=fonseca@diku.dk \
    --cc=git@vger.kernel.org \
    --cc=pasky@ucw.cz \
    /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.
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 NNTP newsgroup(s).