{"thread":{"id":"13524","subject":"[PATCH] Fix sed syntax in t7502-commit for OSX","startedAt":"2008-05-15T02:19:08Z","lastAt":"2008-05-16T09:56:07Z","messageCount":7,"participants":["Marcel Koeppen","Junio C Hamano","Holger Schurig","Santi Béjar","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"77010","messageId":"1210817948-72280-1-git-send-email-git-dev@marzelpan.de","threadId":"13524","inReplyTo":null,"subject":"[PATCH] Fix sed syntax in t7502-commit for OSX","fromName":"Marcel Koeppen","fromEmail":"git-dev@marzelpan.de","sentAt":"2008-05-15T02:19:08Z","receivedAt":"2008-05-15T02:19:08Z","isPatch":true,"sender":{"key":"git-dev@marzelpan.de","avatar":"https://gravatar.com/avatar/73c4b29dc13b236d868ba2f40a10262caaf43c0e37d48c459ca07bf3176fa1ba?d=mp&s=160"},"body":"The OSX version of sed interprets the command as argument to the -i option.\n\nSigned-off-by: Marcel Koeppen <git-dev@marzelpan.de>\n---\n t/t7502-commit.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t7502-commit.sh b/t/t7502-commit.sh\nindex 018060c..9a43104 100755\n--- a/t/t7502-commit.sh\n+++ b/t/t7502-commit.sh\n@@ -166,7 +166,7 @@ test_expect_success 'author different from committer' '\n \ttest_cmp expect actual\n '\n \n-sed -i '$d' expect\n+sed -i -e '$d' expect\n echo \"# Committer:\n #\" >> expect\n unset GIT_COMMITTER_EMAIL\n-- \n1.5.5.1.215.g64c0d\n"},{"id":"77029","messageId":"7vwslwgdyi.fsf@gitster.siamese.dyndns.org","threadId":"13524","inReplyTo":"1210817948-72280-1-git-send-email-git-dev@marzelpan.de","subject":"Re: [PATCH] Fix sed syntax in t7502-commit for OSX","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-15T08:37:41Z","receivedAt":"2008-05-15T08:37:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcel Koeppen <git-dev@marzelpan.de> writes:\n\n> The OSX version of sed interprets the command as argument to the -i option.\n>\n> Signed-off-by: Marcel Koeppen <git-dev@marzelpan.de>\n> ---\n>  t/t7502-commit.sh |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh\n> index 018060c..9a43104 100755\n> --- a/t/t7502-commit.sh\n> +++ b/t/t7502-commit.sh\n> @@ -166,7 +166,7 @@ test_expect_success 'author different from committer' '\n>  \ttest_cmp expect actual\n>  '\n>  \n> -sed -i '$d' expect\n> +sed -i -e '$d' expect\n>  echo \"# Committer:\n>  #\" >> expect\n>  unset GIT_COMMITTER_EMAIL\n\nTwo comments and a half.\n\nThis patch does not make things worse, so I do not have much against it.\n\nHowever, \"sed -i $cmd\" is also used in templates/hooks--prepare-commit-msg\nand you would want to fix it as well.\n\nBut more importantly, as we are serious about portability, we should not\nbe using \"sed -i\" which is not even in POSIX to begin with.  Can we\nrewrite these places without using the in-place extension?\n"},{"id":"77033","messageId":"200805151058.34774.hs4233@mail.mn-solutions.de","threadId":"13524","inReplyTo":"7vwslwgdyi.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Fix sed syntax in t7502-commit for OSX","fromName":"Holger Schurig","fromEmail":"hs4233@mail.mn-solutions.de","sentAt":"2008-05-15T08:58:34Z","receivedAt":"2008-05-15T08:58:34Z","isPatch":true,"sender":{"key":"hs4233@mail.mn-solutions.de","avatar":null},"body":"> > -sed -i '$d' expect\n> > +sed -i -e '$d' expect\n\nperl -pi -e 's/foo/bar/' ???\n\nGIT already needs perl, so we can re-use it's features savely.\n"},{"id":"77036","messageId":"8aa486160805150237t734b24dcw4a153e41cbc7436e@mail.gmail.com","threadId":"13524","inReplyTo":"7vwslwgdyi.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Fix sed syntax in t7502-commit for OSX","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-05-15T09:37:32Z","receivedAt":"2008-05-15T09:37:32Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Thu, May 15, 2008 at 10:37 AM, Junio C Hamano <gitster@pobox.com> wrote:\n\n>\n> But more importantly, as we are serious about portability, we should not\n> be using \"sed -i\" which is not even in POSIX to begin with.\n\nIs there a way (environment variable, flag) to test if it is POSIX? Or\nwe just have to know?\n\nI'll send a patch to document the \"sed -i\" issue in\nDocumentation/CodingGuidelines.\n\n>  Can we\n> rewrite these places without using the in-place extension?\n\nYes, I'll do it soon if nobody beats me.\n\nSanti\n"},{"id":"77043","messageId":"22590A7D-0409-4940-BC2E-776B2189BFEC@marzelpan.de","threadId":"13524","inReplyTo":"200805151058.34774.hs4233@mail.mn-solutions.de","subject":"Re: [PATCH] Fix sed syntax in t7502-commit for OSX","fromName":"Marcel Koeppen","fromEmail":"git-dev@marzelpan.de","sentAt":"2008-05-15T11:06:07Z","receivedAt":"2008-05-15T11:06:07Z","isPatch":true,"sender":{"key":"git-dev@marzelpan.de","avatar":"https://gravatar.com/avatar/73c4b29dc13b236d868ba2f40a10262caaf43c0e37d48c459ca07bf3176fa1ba?d=mp&s=160"},"body":"\nAm 15.05.2008 um 10:58 schrieb Holger Schurig:\n\n>>> -sed -i '$d' expect\n>>> +sed -i -e '$d' expect\n>\n> perl -pi -e 's/foo/bar/' ???\n\nThis does not work with '$d', so we could use sed with a temp instead  \nof the -i extension. Alternatively we could specify the full test  \nfixture instead of editing an old one. This would make the expected  \nresults more obvious and the tests would work without assumptions  \nabout running order.\n\nMarcel\n"},{"id":"77091","messageId":"1210897303-80828-1-git-send-email-git-dev@marzelpan.de","threadId":"13524","inReplyTo":"7vwslwgdyi.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] Replace in-place sed in t7502-commit","fromName":"Marcel Koeppen","fromEmail":"git-dev@marzelpan.de","sentAt":"2008-05-16T00:21:43Z","receivedAt":"2008-05-16T00:21:43Z","isPatch":true,"sender":{"key":"git-dev@marzelpan.de","avatar":"https://gravatar.com/avatar/73c4b29dc13b236d868ba2f40a10262caaf43c0e37d48c459ca07bf3176fa1ba?d=mp&s=160"},"body":"The in-place mode of sed used in t7502-commit is a non-POSIX extension.\nThat call of sed is replaced by a more portable version using a temporary file.\n\nSigned-off-by: Marcel Koeppen <git-dev@marzelpan.de>\n---\n t/t7502-commit.sh |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t7502-commit.sh b/t/t7502-commit.sh\nindex 018060c..3531a99 100755\n--- a/t/t7502-commit.sh\n+++ b/t/t7502-commit.sh\n@@ -166,7 +166,9 @@ test_expect_success 'author different from committer' '\n \ttest_cmp expect actual\n '\n \n-sed -i '$d' expect\n+mv expect expect.tmp\n+sed '$d' < expect.tmp > expect\n+rm -f expect.tmp\n echo \"# Committer:\n #\" >> expect\n unset GIT_COMMITTER_EMAIL\n-- \n1.5.5.1.215.g64c0d\n"},{"id":"77104","messageId":"20080516095606.GA25045@sigill.intra.peff.net","threadId":"13524","inReplyTo":"1210897303-80828-1-git-send-email-git-dev@marzelpan.de","subject":"Re: [PATCH] Replace in-place sed in t7502-commit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-16T09:56:07Z","receivedAt":"2008-05-16T09:56:07Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 16, 2008 at 02:21:43AM +0200, Marcel Koeppen wrote:\n\n> The in-place mode of sed used in t7502-commit is a non-POSIX extension.\n> That call of sed is replaced by a more portable version using a\n> temporary file.\n\nThanks, this fixes a similar issue on FreeBSD (which is probably the\nsame sed).\n\n-Peff\n"}]}