{"thread":{"id":"15303","subject":"[PATCH] t6013: Avoid using tac","startedAt":"2008-08-31T20:03:18Z","lastAt":"2008-09-01T16:32:16Z","messageCount":5,"participants":["Brian Gernhardt","Thomas Rast","Andreas Ericsson","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"89337","messageId":"1220212998-90810-1-git-send-email-benji@silverinsanity.com","threadId":"15303","inReplyTo":null,"subject":"[PATCH] t6013: Avoid using tac","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2008-08-31T20:03:18Z","receivedAt":"2008-08-31T20:03:18Z","isPatch":true,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"Although tac is useful for testing for reversed output, it is not\navailable everywhere.  Replace uses of tac with hand-rolled expected\nfiles.\n\nSigned-off-by: Brian Gernhardt <benji@silverinsanity.com>\n---\n t/t6013-rev-list-reverse-parents.sh |   20 ++++++++++++++++----\n 1 files changed, 16 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t6013-rev-list-reverse-parents.sh b/t/t6013-rev-list-reverse-parents.sh\nindex d294466..f023fae 100755\n--- a/t/t6013-rev-list-reverse-parents.sh\n+++ b/t/t6013-rev-list-reverse-parents.sh\n@@ -23,17 +23,29 @@ test_expect_success 'set up --reverse example' '\n \tcommit five\n \t'\n \n+cat >expected <<\\EOF\n+86412ffbe95da677fa145e05bcedc75d0d4e49f7\n+4931c530d1fde996a29be48a97a056f13ab5e9ce 86412ffbe95da677fa145e05bcedc75d0d4e49f7\n+0fcb03eaefb4569dea16195a244d95523cff4934 86412ffbe95da677fa145e05bcedc75d0d4e49f7\n+524efe5b12a180964d586b6c47314ea015a98614 4931c530d1fde996a29be48a97a056f13ab5e9ce 0fcb03eaefb4569dea16195a244d95523cff4934\n+2ed4a763ad375916b4f0fc34ed08f5843299ded6 524efe5b12a180964d586b6c47314ea015a98614\n+EOF\n+\n test_expect_success '--reverse --parents --full-history combines correctly' '\n-\tgit rev-list --parents --full-history master -- foo |\n-\t\ttac > expected &&\n \tgit rev-list --reverse --parents --full-history master -- foo \\\n \t\t> actual &&\n \ttest_cmp actual expected\n \t'\n \n+cat >expected <<\\EOF\n+-86412ffbe95da677fa145e05bcedc75d0d4e49f7\n+4931c530d1fde996a29be48a97a056f13ab5e9ce 86412ffbe95da677fa145e05bcedc75d0d4e49f7\n+0fcb03eaefb4569dea16195a244d95523cff4934 86412ffbe95da677fa145e05bcedc75d0d4e49f7\n+524efe5b12a180964d586b6c47314ea015a98614 4931c530d1fde996a29be48a97a056f13ab5e9ce 0fcb03eaefb4569dea16195a244d95523cff4934\n+2ed4a763ad375916b4f0fc34ed08f5843299ded6 524efe5b12a180964d586b6c47314ea015a98614\n+EOF\n+\n test_expect_success '--boundary does too' '\n-\tgit rev-list --boundary --parents --full-history master ^root -- foo |\n-\t\ttac > expected &&\n \tgit rev-list --boundary --reverse --parents --full-history \\\n \t\tmaster ^root -- foo > actual &&\n \ttest_cmp actual expected\n-- \n1.6.0.1.207.g020e5\n"},{"id":"89344","messageId":"1220221897-6081-1-git-send-email-trast@student.ethz.ch","threadId":"15303","inReplyTo":"1220212998-90810-1-git-send-email-benji@silverinsanity.com","subject":"[PATCH] t6013: replace use of 'tac' with equivalent Perl","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2008-08-31T22:31:37Z","receivedAt":"2008-08-31T22:31:37Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"'tac' is not available everywhere, so substitute the equivalent Perl\ncode 'print reverse <>'.  Noticed by Brian Gernhardt.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nThanks for pointing this out.  However, I tried to avoid hardcoding\nthose results by recommendation of t/README (last paragraph):\n\n  ... If all the test scripts hardcoded the object IDs like\n  t0000-basic.sh does, that defeats the purpose of t0000-basic.sh,\n  which is to isolate that level of validation in one place.  Your\n  test also ends up needing updating when such a change to the\n  internal happens, so do _not_ do it and leave the low level of\n  validation to t0000-basic.sh.\n\nSo I would favour this fix.  I think this should be ok because we\ndepend on Perl anyway.\n\n- Thomas\n\n\n t/t6013-rev-list-reverse-parents.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t6013-rev-list-reverse-parents.sh b/t/t6013-rev-list-reverse-parents.sh\nindex d294466..59fc2f0 100755\n--- a/t/t6013-rev-list-reverse-parents.sh\n+++ b/t/t6013-rev-list-reverse-parents.sh\n@@ -25,7 +25,7 @@ test_expect_success 'set up --reverse example' '\n \n test_expect_success '--reverse --parents --full-history combines correctly' '\n \tgit rev-list --parents --full-history master -- foo |\n-\t\ttac > expected &&\n+\t\tperl -e \"print reverse <>\" > expected &&\n \tgit rev-list --reverse --parents --full-history master -- foo \\\n \t\t> actual &&\n \ttest_cmp actual expected\n@@ -33,7 +33,7 @@ test_expect_success '--reverse --parents --full-history combines correctly' '\n \n test_expect_success '--boundary does too' '\n \tgit rev-list --boundary --parents --full-history master ^root -- foo |\n-\t\ttac > expected &&\n+\t\tperl -e \"print reverse <>\" > expected &&\n \tgit rev-list --boundary --reverse --parents --full-history \\\n \t\tmaster ^root -- foo > actual &&\n \ttest_cmp actual expected\n-- \n1.6.0.1.282.g3cc57\n"},{"id":"89412","messageId":"48BBE682.2070000@op5.se","threadId":"15303","inReplyTo":"1220221897-6081-1-git-send-email-trast@student.ethz.ch","subject":"Re: [PATCH] t6013: replace use of 'tac' with equivalent Perl","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-09-01T12:56:34Z","receivedAt":"2008-09-01T12:56:34Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Thomas Rast wrote:\n> 'tac' is not available everywhere, so substitute the equivalent Perl\n> code 'print reverse <>'.  Noticed by Brian Gernhardt.\n> \n> Signed-off-by: Thomas Rast <trast@student.ethz.ch>\n> ---\n> \n> Thanks for pointing this out.  However, I tried to avoid hardcoding\n> those results by recommendation of t/README (last paragraph):\n> \n>   ... If all the test scripts hardcoded the object IDs like\n>   t0000-basic.sh does, that defeats the purpose of t0000-basic.sh,\n>   which is to isolate that level of validation in one place.  Your\n>   test also ends up needing updating when such a change to the\n>   internal happens, so do _not_ do it and leave the low level of\n>   validation to t0000-basic.sh.\n> \n> So I would favour this fix.  I think this should be ok because we\n> depend on Perl anyway.\n> \n\nIf it isn't, you could always do\n\tsed '1!G;h;$!d'\nor\n\tsed -n '1!G;h;$p'\ninstead.\n\nBoth of them are very portable indeed.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"89423","messageId":"41757CC9-DB9B-41C9-A698-E2948F79DC2C@silverinsanity.com","threadId":"15303","inReplyTo":"48BBE682.2070000@op5.se","subject":"Re: [PATCH] t6013: replace use of 'tac' with equivalent Perl","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2008-09-01T16:05:01Z","receivedAt":"2008-09-01T16:05:01Z","isPatch":true,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"\nOn Sep 1, 2008, at 8:56 AM, Andreas Ericsson wrote:\n\n> Thomas Rast wrote:\n>> So I would favour this fix.  I think this should be ok because we\n>> depend on Perl anyway.\n>\n> If it isn't, you could always do\n> \tsed '1!G;h;$!d'\n> or\n> \tsed -n '1!G;h;$p'\n> instead.\n>\n> Both of them are very portable indeed.\n\nI am reminded of the last time I tried to remove a use of tac from git  \n(rebase -i, to be specific).  I was yelled at for trying to use perl,  \nand \"sed -ne '1!G;$p;h'\" turned out to be not portable enough.   \nEventually the command was re-written not to need the reversal.\n\nJunio seems to think perl is just fine, judging by next, so I guess  \nI'll just give up trying to second guess what the list wants.  :-/\n\n~~ Brian\n"},{"id":"89427","messageId":"alpine.DEB.1.00.0809011831200.13830@pacific.mpi-cbg.de.mpi-cbg.de","threadId":"15303","inReplyTo":"41757CC9-DB9B-41C9-A698-E2948F79DC2C@silverinsanity.com","subject":"Re: [PATCH] t6013: replace use of 'tac' with equivalent Perl","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-09-01T16:32:16Z","receivedAt":"2008-09-01T16:32:16Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 1 Sep 2008, Brian Gernhardt wrote:\n\n> I am reminded of the last time I tried to remove a use of tac from git \n> (rebase -i, to be specific).  I was yelled at for trying to use perl, \n> and \"sed -ne '1!G;$p;h'\" turned out to be not portable enough.\n\nPlease note that using Perl in test scripts is considered less bad than \nusing Perl in a shell script which is part of Git's core.\n\nCiao,\nDscho\n"}]}