{"thread":{"id":"25202","subject":"quoting in get_author_ident_from_commit","startedAt":"2010-09-22T21:23:02Z","lastAt":"2010-09-27T04:15:38Z","messageCount":3,"participants":["Uwe Kleine-König","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"151326","messageId":"20100922212302.GA22368@pengutronix.de","threadId":"25202","inReplyTo":null,"subject":"quoting in get_author_ident_from_commit","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-09-22T21:23:02Z","receivedAt":"2010-09-22T21:23:02Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nI wonder about the quoting done in get_author_ident_from_commit's sed\nscript.\n\nIt first does 's/'\\''/'\\''\\\\'\\'\\''/g', then 's/'\\''/'\\''\\'\\'\\''/g' (the\nlatter once for each resulting line).\nWhat sed actually sees is:\n\n\ts/'/'\\\\''/g\n\ts/'/'\\''/g \n\nThe second instruction only substitutes a single quote by three single\nquotes because \\' is just interpreted as '.\n\nSo I think just removing the three occurences of the second substitute\ncommand just can be removed, as ''' effectively is the same as '.\n\nDo I miss something?\n\n(The first command was introduced in\naa66c7ec77d474b737da607d6cb2d07f56628def, the second was introduced with\ngit commit -m in fec3ef101c0f18bbf2400423dc70e686e9d25b0)\n\nThanks\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"151353","messageId":"1285233730-30611-1-git-send-email-u.kleine-koenig@pengutronix.de","threadId":"25202","inReplyTo":"20100922212302.GA22368@pengutronix.de","subject":"[PATCH] get_author_ident_from_commit(): remove useless quoting","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-09-23T09:22:10Z","receivedAt":"2010-09-23T09:22:10Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"The command 's/'\\''/'\\''\\'\\'\\''/g' only triples single quotes:\n\n\t$ echo \"What's up?\" | sed 's/'\\''/'\\''\\'\\'\\''/g'\n\tWhat'''s up?\n\nThis doesn't hurt as compared to a single single quote it only adds an\nempty string, but it makes the script needlessly complicated and hard to\nunderstand.  The useful quoting is done by s/'\\''/'\\''\\\\'\\'\\''/g at the\nbeginning of the script and only once for all three variables.\n\nSigned-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n---\n git-sh-setup.sh |    3 ---\n 1 files changed, 0 insertions(+), 3 deletions(-)\n\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 6131670..8d54b73 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -151,17 +151,14 @@ get_author_ident_from_commit () {\n \t\ts/'\\''/'\\''\\\\'\\'\\''/g\n \t\th\n \t\ts/^author \\([^<]*\\) <[^>]*> .*$/\\1/\n-\t\ts/'\\''/'\\''\\'\\'\\''/g\n \t\ts/.*/GIT_AUTHOR_NAME='\\''&'\\''/p\n \n \t\tg\n \t\ts/^author [^<]* <\\([^>]*\\)> .*$/\\1/\n-\t\ts/'\\''/'\\''\\'\\'\\''/g\n \t\ts/.*/GIT_AUTHOR_EMAIL='\\''&'\\''/p\n \n \t\tg\n \t\ts/^author [^<]* <[^>]*> \\(.*\\)$/\\1/\n-\t\ts/'\\''/'\\''\\'\\'\\''/g\n \t\ts/.*/GIT_AUTHOR_DATE='\\''&'\\''/p\n \n \t\tq\n-- \n1.7.2.3\n"},{"id":"151784","messageId":"7vfwwvn7o5.fsf@alter.siamese.dyndns.org","threadId":"25202","inReplyTo":"1285233730-30611-1-git-send-email-u.kleine-koenig@pengutronix.de","subject":"Re: [PATCH] get_author_ident_from_commit(): remove useless quoting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-09-27T04:15:38Z","receivedAt":"2010-09-27T04:15:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Uwe Kleine-König  <u.kleine-koenig@pengutronix.de> writes:\n\n> The command 's/'\\''/'\\''\\'\\'\\''/g' only triples single quotes:\n>\n> \t$ echo \"What's up?\" | sed 's/'\\''/'\\''\\'\\'\\''/g'\n> \tWhat'''s up?\n>\n> This doesn't hurt as compared to a single single quote it only adds an\n> empty string, but it makes the script needlessly complicated and hard to\n> understand.\n\nInteresting.  I think this was an ancient misconversion that dates back to\nJune 2005 ;-)\n\nThanks.\n"}]}