git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] get_author_ident_from_commit(): remove useless quoting
Date: Thu, 23 Sep 2010 11:22:10 +0200	[thread overview]
Message-ID: <1285233730-30611-1-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20100922212302.GA22368@pengutronix.de>

The command 's/'\''/'\''\'\'\''/g' only triples single quotes:

	$ echo "What's up?" | sed 's/'\''/'\''\'\'\''/g'
	What'''s up?

This doesn't hurt as compared to a single single quote it only adds an
empty string, but it makes the script needlessly complicated and hard to
understand.  The useful quoting is done by s/'\''/'\''\\'\'\''/g at the
beginning of the script and only once for all three variables.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 git-sh-setup.sh |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 6131670..8d54b73 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -151,17 +151,14 @@ get_author_ident_from_commit () {
 		s/'\''/'\''\\'\'\''/g
 		h
 		s/^author \([^<]*\) <[^>]*> .*$/\1/
-		s/'\''/'\''\'\'\''/g
 		s/.*/GIT_AUTHOR_NAME='\''&'\''/p
 
 		g
 		s/^author [^<]* <\([^>]*\)> .*$/\1/
-		s/'\''/'\''\'\'\''/g
 		s/.*/GIT_AUTHOR_EMAIL='\''&'\''/p
 
 		g
 		s/^author [^<]* <[^>]*> \(.*\)$/\1/
-		s/'\''/'\''\'\'\''/g
 		s/.*/GIT_AUTHOR_DATE='\''&'\''/p
 
 		q
-- 
1.7.2.3

  reply	other threads:[~2010-09-23  9:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-22 21:23 quoting in get_author_ident_from_commit Uwe Kleine-König
2010-09-23  9:22 ` Uwe Kleine-König [this message]
2010-09-27  4:15   ` [PATCH] get_author_ident_from_commit(): remove useless quoting Junio C Hamano

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=1285233730-30611-1-git-send-email-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --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.
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).