* [PATCH Cogito] cg-log: improve parsing -r
@ 2005-05-29 1:41 Jonas Fonseca
0 siblings, 0 replies; only message in thread
From: Jonas Fonseca @ 2005-05-29 1:41 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-05-29 1:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-29 1:41 [PATCH Cogito] cg-log: improve parsing -r Jonas Fonseca
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).