{"thread":{"id":"5571","subject":"[PATCH] Skip t3403 selftests if stdin is not a terminal","startedAt":"2006-09-15T12:59:10Z","lastAt":"2006-09-19T17:04:42Z","messageCount":4,"participants":["Gerrit Pape","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"26969","messageId":"20060915125910.10514.qmail@26499ea44f2ee3.315fe32.mid.smarden.org","threadId":"5571","inReplyTo":null,"subject":"[PATCH] Skip t3403 selftests if stdin is not a terminal","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2006-09-15T12:59:10Z","receivedAt":"2006-09-15T12:59:10Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"sh t3403-rebase-skip.sh </dev/null fails because stdin is not connected\nto a terminal, as in the Debian autobuild environment.  This disbales\nthe test 3 and 7 in this case.\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n\n---\n t/t3403-rebase-skip.sh |   23 +++++++++++++++++------\n 1 files changed, 17 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh\nindex 8ab63c5..983d152 100755\n--- a/t/t3403-rebase-skip.sh\n+++ b/t/t3403-rebase-skip.sh\n@@ -39,10 +39,16 @@ test_expect_success setup '\n \n test_expect_failure 'rebase with git am -3 (default)' 'git rebase master'\n \n-test_expect_success 'rebase --skip with am -3' '\n-\tgit reset --hard HEAD &&\n-\tgit rebase --skip\n-\t'\n+if tty -s\n+then\n+\ttest_expect_success 'rebase --skip with am -3' '\n+\t\tgit reset --hard HEAD &&\n+\t\tgit rebase --skip\n+\t\t'\n+else\n+\techo 'stdin is not a terminal, skip test.'\n+fi\n+\n test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'\n \n test_expect_failure 'rebase with --merge' 'git rebase --merge master'\n@@ -52,8 +58,13 @@ test_expect_success 'rebase --skip with \n \tgit rebase --skip\n \t'\n \n-test_expect_success 'merge and reference trees equal' \\\n-\t'test -z \"`git-diff-tree skip-merge skip-reference`\"'\n+if tty -s\n+then\n+\ttest_expect_success 'merge and reference trees equal' \\\n+\t\t'test -z \"`git-diff-tree skip-merge skip-reference`\"'\n+else\n+\techo 'stdin is not a terminal, skip test.'\n+fi\n \n test_debug 'gitk --all & sleep 1'\n \n-- \n1.4.2.1\n"},{"id":"26993","messageId":"7vk644e5f5.fsf@assigned-by-dhcp.cox.net","threadId":"5571","inReplyTo":"20060915125910.10514.qmail@26499ea44f2ee3.315fe32.mid.smarden.org","subject":"Re: [PATCH] Skip t3403 selftests if stdin is not a terminal","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-16T05:39:26Z","receivedAt":"2006-09-16T05:39:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gerrit Pape <pape@smarden.org> writes:\n\n> sh t3403-rebase-skip.sh </dev/null fails because stdin is not connected\n> to a terminal, as in the Debian autobuild environment.  This disbales\n> the test 3 and 7 in this case.\n\nDisabling these tests somehow feels as if you are shooting the\nmessenger who reports breakage of the commands they try to test.\n\nIs it expected that the git Porcelainish commands involved in\nthese particular tests not to work without terminal?  If not\nmaybe we should fix them, not the test.\n"},{"id":"26995","messageId":"7v3base3l5.fsf@assigned-by-dhcp.cox.net","threadId":"5571","inReplyTo":"7vk644e5f5.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Skip t3403 selftests if stdin is not a terminal","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-16T06:19:02Z","receivedAt":"2006-09-16T06:19:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Gerrit Pape <pape@smarden.org> writes:\n>\n>> sh t3403-rebase-skip.sh </dev/null fails because stdin is not connected\n>> to a terminal, as in the Debian autobuild environment.  This disbales\n>> the test 3 and 7 in this case.\n>\n> Disabling these tests somehow feels as if you are shooting the\n> messenger who reports breakage of the commands they try to test.\n>\n> Is it expected that the git Porcelainish commands involved in\n> these particular tests not to work without terminal?  If not\n> maybe we should fix them, not the test.\n\nHow about this instead?\n\n-- >8 --\nFix git-am safety checks\n\nAn earlier commit cbd64af added a check that prevents \"git-am\"\nto run without its standard input connected to a terminal while\nresuming operation.  This was to catch a user error to try\nfeeding a new patch from its standard input while recovery.\n\nThe assumption of the check was that it is an indication that a\nnew patch is being fed if the standard input is not connected to\na terminal.  It is however not quite correct (the standard input\ncan be /dev/null if the user knows the operation does not need\nany input, for example).  This broke t3403 when the test was run\nwith its standard input connected to /dev/null.\n\nWhen git-am is given an explicit command such as --skip, there\nis no reason to insist that the standard input is a terminal; we\nare not going to read a new patch anyway.\n\nCredit goes to Gerrit Pape for noticing and reporting the\nproblem with t3403-rebase-skip test.\n\n---\ndiff --git a/git-am.sh b/git-am.sh\nindex d0af786..66a8e3d 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -166,10 +166,25 @@ fi\n \n if test -d \"$dotest\"\n then\n-\tif test \",$#,\" != \",0,\" || ! tty -s\n-\tthen\n-\t\tdie \"previous dotest directory $dotest still exists but mbox given.\"\n-\tfi\n+\tcase \"$#,$skip$resolved\" in    \n+\t0,*t*)\n+\t\t# Explicit resume command and we do not have file, so\n+\t\t# we are happy.\n+\t\t: ;;\n+\t0,)\n+\t\t# No file input but without resume parameters; catch\n+\t\t# user error to feed us a patch from standard input\n+\t\t# when there is already .dotest.  This is somewhat\n+\t\t# unreliable -- stdin could be /dev/null for example\n+\t\t# and the caller did not intend to feed us a patch but\n+\t\t# wanted to continue unattended.\n+\t\ttty -s\n+\t\t;;\n+\t*)\n+\t\tfalse\n+\t\t;;\n+\tesac ||\n+\tdie \"previous dotest directory $dotest still exists but mbox given.\"\n \tresume=yes\n else\n \t# Make sure we are not given --skip nor --resolved\n"},{"id":"27163","messageId":"20060919170442.28169.qmail@e5754f1244ec85.315fe32.mid.smarden.org","threadId":"5571","inReplyTo":"7v3base3l5.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Skip t3403 selftests if stdin is not a terminal","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2006-09-19T17:04:42Z","receivedAt":"2006-09-19T17:04:42Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"On Fri, Sep 15, 2006 at 11:19:02PM -0700, Junio C Hamano wrote:\n> Junio C Hamano <junkio@cox.net> writes:\n> > Gerrit Pape <pape@smarden.org> writes:\n> >> sh t3403-rebase-skip.sh </dev/null fails because stdin is not connected\n> >> to a terminal, as in the Debian autobuild environment.  This disbales\n> >> the test 3 and 7 in this case.\n> >\n> > Disabling these tests somehow feels as if you are shooting the\n> > messenger who reports breakage of the commands they try to test.\n> >\n> > Is it expected that the git Porcelainish commands involved in\n> > these particular tests not to work without terminal?  If not\n> > maybe we should fix them, not the test.\n> \n> How about this instead?\n\nYes, this is the better fix, I agree.  The selftests work fine for me\nwith this patch applied.\n\nThanks, Gerrit.\n"}]}