git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] get_author_ident_from_commit(): remove useless quoting

From
Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date
Sep 23, 2010, 09:22 UTC
Message-ID
<1285233730-30611-1-git-send-email-u.kleine-koenig@pengutronix.de>
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
Previous: Uwe Kleine-KönigNext: Junio C Hamano
Message 2 of 3 in “quoting in get_author_ident_from_commit”
  1. Uwe Kleine-KönigSep 22, 2010
  2. get_author_ident_from_commit(): remove useless quotingUwe Kleine-König, Sep 23, 2010
  3. Junio C HamanoSep 27, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.