Hi again, On Thu, Jul 03, 2008 at 03:11:45PM -0700, Junio C Hamano wrote: > Stephan Beyer <s-beyer@xxxxxxx> writes: > > + sed -e 's/[$"\\]/\\&/g' -n -e ' > > s/^Author: \(.*\)$/GIT_AUTHOR_NAME="\1"/p; > > s/^Email: \(.*\)$/GIT_AUTHOR_EMAIL="\1"/p; > > s/^Date: \(.*\)$/GIT_AUTHOR_DATE="\1"/p > > ### > > > > Is escaping $, " and \ enough? > > Look at how it is done in git-sh-setup get_author_ident_from_commit. Yes, single quotes are the other variant and perhaps a little more robust. --- a/git-sequencer.sh +++ b/git-sequencer.sh @@ -520,8 +520,9 @@ clean_author_script () { # Take "Name <e-mail>" in stdin and outputs author script make_author_script_from_string () { - sed -e 's/^\(.*\) <\(.*\)>.*$/GIT_AUTHOR_NAME="\1"\ -GIT_AUTHOR_EMAIL="\2"\ + sed -e "s/'/'"'\\'"''/g" \ + -e 's/^\(.*\) <\(.*\)>.*$/GIT_AUTHOR_NAME='\''\1'\''\ +GIT_AUTHOR_EMAIL='\''\2'\''\ GIT_AUTHOR_DATE=/' } @@ -779,10 +780,10 @@ insn_patch () { if test -z "$AUTHOR" then - sed -n -e ' - s/^Author: \(.*\)$/GIT_AUTHOR_NAME="\1"/p; - s/^Email: \(.*\)$/GIT_AUTHOR_EMAIL="\1"/p; - s/^Date: \(.*\)$/GIT_AUTHOR_DATE="\1"/p + sed -e "s/'/'"'\\'"''/g" -n -e ' + s/^Author: \(.*\)$/GIT_AUTHOR_NAME='\''\1'\''/p; + s/^Email: \(.*\)$/GIT_AUTHOR_EMAIL='\''\1'\''/p; + s/^Date: \(.*\)$/GIT_AUTHOR_DATE='\''\1'\''/p ' <"$infofile" >>"$AUTHOR_SCRIPT" # If sed's result is empty, we keep the original # author script by appending. ### On Thu, Jul 03, 2008 at 11:09:50PM +0200, Stephan Beyer wrote: > And as long as nobody is named $(rm -rf "$HOME") [1], I thought this is > sufficient for the prototype. Btw, the [1] should have been a link to http://xkcd.com/327/ Just if you're wondering ;-) Regards, Stephan -- Stephan Beyer <s-beyer@xxxxxxx>, PGP 0x6EDDD207FCC5040F -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html