{"thread":{"id":"39173","subject":"[PATCH] Fixup test-lint error in git-p4 t9814 test","startedAt":"2015-04-27T22:20:27Z","lastAt":"2015-04-27T23:02:23Z","messageCount":3,"participants":["Luke Diamand","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"260086","messageId":"1430173228-22004-1-git-send-email-luke@diamand.org","threadId":"39173","inReplyTo":null,"subject":"[PATCH] Fixup test-lint error in git-p4 t9814 test","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2015-04-27T22:20:27Z","receivedAt":"2015-04-27T22:20:27Z","isPatch":true,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"While running the git-p4 tests, I noticed that t9814 has started\nfailing due to the (very ingenious!) chain-lint detection introduced\nin:\n\n   bb79af9 t/test-lib: introduce --chain-lint option\n\nI think that what's going on is that the chain-lint test is\ngetting itself confused by this test, which is designed to always\nsucceed, regardless of whether the individual sub-commands succeed\nor not, since it's just setting up a pre-requisite for later use.\n\nI've added an additional set of braces, which makes it clearer\nto the --chain-lint code what's going on, but I'd be interested to\nknow if this is the right way to fix this.\n\nThanks,\nLuke\n\nLuke Diamand (1):\n  git-p4: prevent --chain-lint failure\n\n t/t9814-git-p4-rename.sh | 16 +++++++++-------\n 1 file changed, 9 insertions(+), 7 deletions(-)\n\n-- \n2.3.4.48.g223ab37\n"},{"id":"260087","messageId":"1430173228-22004-2-git-send-email-luke@diamand.org","threadId":"39173","inReplyTo":"1430173228-22004-1-git-send-email-luke@diamand.org","subject":"[PATCH] git-p4: prevent --chain-lint failure","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2015-04-27T22:20:28Z","receivedAt":"2015-04-27T22:20:28Z","isPatch":true,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"t9814 has a test that simply sets up a pre-requisite for\nanother test, and as such, always succeeds. The way it was\nwritten doesn't quite work with the test lint checks introduced\nwith the --chain-lint option.\n\nAdd an additional layer of {} to prevent the --chain-lint\ncode getting confused.\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n t/t9814-git-p4-rename.sh | 16 +++++++++-------\n 1 file changed, 9 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh\nindex 99bb71b..14f9dc3 100755\n--- a/t/t9814-git-p4-rename.sh\n+++ b/t/t9814-git-p4-rename.sh\n@@ -227,13 +227,15 @@ test_expect_success 'detect copies' '\n # See if configurables can be set, and in particular if the run.move.allow\n # variable exists, which allows admins to disable the \"p4 move\" command.\n test_expect_success 'p4 configure command and run.move.allow are available' '\n-\tp4 configure show run.move.allow >out ; retval=$? &&\n-\ttest $retval = 0 &&\n-\t{\n-\t\tegrep ^run.move.allow: out &&\n-\t\ttest_set_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW ||\n-\t\ttrue\n-\t} || true\n+    {\n+\t    p4 configure show run.move.allow >out ; retval=$? &&\n+\t    test $retval = 0 &&\n+\t    {\n+\t\t    egrep ^run.move.allow: out &&\n+\t\t    test_set_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW ||\n+\t\t    true\n+\t    } || true\n+    }\n '\n \n # If move can be disabled, turn it off and test p4 move handling\n-- \n2.3.4.48.g223ab37\n"},{"id":"260088","messageId":"20150427230223.GA22403@peff.net","threadId":"39173","inReplyTo":"1430173228-22004-2-git-send-email-luke@diamand.org","subject":"Re: [PATCH] git-p4: prevent --chain-lint failure","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-04-27T23:02:23Z","receivedAt":"2015-04-27T23:02:23Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 27, 2015 at 11:20:28PM +0100, Luke Diamand wrote:\n\n> t9814 has a test that simply sets up a pre-requisite for\n> another test, and as such, always succeeds. The way it was\n> written doesn't quite work with the test lint checks introduced\n> with the --chain-lint option.\n> \n> Add an additional layer of {} to prevent the --chain-lint\n> code getting confused.\n\nThanks for looking into this. I tried to fix any existing tests I could,\nbut I missed ones whose prerequisites aren't met on my system.\n\nUsing {} is reasonable in general; that's how the fixes in 9ddc5ac (t:\nwrap complicated expect_code users in a block, 2015-03-20) worked.\nHowever, I think your case is somewhat simpler, in that you really just\nwant a big conditional to set a prereq based on whether or not a command\nsucceeds.\n\nWould it make sense to convert this whole thing to just:\n\n  test_lazy_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW '\n\tp4 configure show run.move.allow >out &&\n\tegrep ^run.move.allow: out\n  '\n\n?\n\n-Peff\n"}]}