git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alecs King <alecsk@gmail.com>
To: git@vger.kernel.org
Subject: Re: [COGITO PATCH] Fix cg-log and cg-status for non-GNU sed/sort
Date: Tue, 31 May 2005 01:00:38 +0800	[thread overview]
Message-ID: <20050530165655.GA1377@alc.bsd.st> (raw)
In-Reply-To: <20050529234911.GZ1036@pasky.ji.cz>

On Mon, May 30, 2005 at 01:49:11AM +0200, Petr Baudis wrote:
> > > > -                               echo; sed -re '
> > > > -                                       /
> > > *Signed-off-by:.*/Is//'$colsignoff'&'$coldefault'/
> > > > -                                       /
> > > *Acked-by:.*/Is//'$colsignoff'&'$coldefault'/
> > > > -                                       s/./    &/
> > > > -                               '
> > > > +                               echo; sed -e "/
> > > > *Signed-off-by:.*/s/
> > > *Signed-off-by:.*/$colsignoff&$coldefault/" -e"/
> > > > +*Acked-by:.*/s/ *Acked-by:.*/$colsignoff&$coldefault/" -e "s/./
> > > > &/"
> > > > +
> > > 
> > > Is it necessary to take away the newlines? What is the real
> > > problem,
> > > actually? Just the I flag?
> > 
> > Is it strictly necessary to take away the newlines? I don't know. To
> > be honest, I didn't 
> > experiment too much with alternate implementations. But the I flag
> > in the sed script, 
> > yes that is not understood by non-GNU sed. And the "-r" to sed
> > itself is also
> > problematic.
> 
> I think we don't really need -r anyway. Could you please try with the
> 'i' flag instead of 'I'? (The manpage is somewhat unclear on the
> difference and portability.) Also, could you try if it works with the
> newlines?

-r here is for the 'I' (same as 'i') modifier, which means case
insensitive.  non-GNU sed might not have the '-r' option or the 'I'
('i') modifier.

I dunno about the strict rules of 'Signed-off-by' things but what i have
seen are all _exactly_ of this form.  I have never seen something like
'SIGNED-OFF-BY' or 'sIGneD-oFf-bY'.

If only the exact case sensitive form is allowed, then we can safely
remove the '-r' and 'I'.

Also, to Mark, as a quick alternative to work around these sed issues,
you can install the gsed port.  IIRC, opendarwin has this port.

Speaking of other portability issues, i made up a patch to make cogito
properly work under fbsd (without hurting others hopefully) weeks ago:

1) expr would regard a negative $dtz as an option (-xx).
2) coloring for both terminfo & termcap terminal.

Index: cg-Xlib
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-Xlib  (mode:100755)
+++ 4e3c899dfa4a74effdb4ae23528785b8f688561d/cg-Xlib  (mode:100755)
@@ -43,7 +43,7 @@
 	date="$1"
 	sec=${date[0]}; tz=${date[1]}
 	dtz=${tz/+/}
-	lsec=$(expr $dtz / 100 \* 3600 + $dtz % 100 \* 60 + $sec)
+	lsec=$(expr \( $dtz \) / 100 \* 3600 + \( $dtz \) % 100 \* 60 +
$sec)
 	pdate="$(date -Rud "1970-01-01 UTC + $lsec sec" 2>/dev/null)"
 
 	echo "${pdate/+0000/$tz}"
Index: cg-log
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-log  (mode:100755)
+++ 4e3c899dfa4a74effdb4ae23528785b8f688561d/cg-log  (mode:100755)
@@ -42,13 +42,14 @@
 	# TODO: Parse -r here too.
 	case "$1" in
 	-c)
-		# See terminfo(5), "Color Handling"
-		colheader="$(tput setaf 2)"    # Green
-		colauthor="$(tput setaf 6)"    # Cyan
-		colcommitter="$(tput setaf 5)" # Magenta
-		colfiles="$(tput setaf 4)"     # Blue
-		colsignoff="$(tput setaf 3)"   # Yellow
-		coldefault="$(tput op)"        # Restore default
+		# ANSI escape seq
+		esc=$(echo -e '\e')
+		colheader="${esc}[0;32m"    # Green
+		colauthor="${esc}[0;36m"    # Cyan
+		colcommitter="${esc}[0;35m" # Magenta
+		colfiles="${esc}[0;34m"     # Blue
+		colsignoff="${esc}[0;33m"   # Yellow
+		coldefault="${esc}[0m"      # Restore default
 		shift
 		;;
 	-f)

-- 
Alecs King

  reply	other threads:[~2005-05-30 16:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-29 23:00 [COGITO PATCH] Fix cg-log and cg-status for non-GNU sed/sort Mark Allen
2005-05-29 23:16 ` Petr Baudis
2005-05-29 23:43   ` Mark Allen
2005-05-29 23:49     ` Petr Baudis
2005-05-30 17:00       ` Alecs King [this message]
2005-05-31  1:19       ` Mark Allen

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=20050530165655.GA1377@alc.bsd.st \
    --to=alecsk@gmail.com \
    --cc=git@vger.kernel.org \
    /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).