{"thread":{"id":"22382","subject":"[PATCH] t5541-http-push: make grep expression check for one line only","startedAt":"2010-01-25T07:42:23Z","lastAt":"2010-01-26T01:37:25Z","messageCount":5,"participants":["Tay Ray Chuan","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"132581","messageId":"1264405343-2984-1-git-send-email-rctay89@gmail.com","threadId":"22382","inReplyTo":null,"subject":"[PATCH] t5541-http-push: make grep expression check for one line only","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-01-25T07:42:23Z","receivedAt":"2010-01-25T07:42:23Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Simplify the grep expressions in the non-fast-forward tests to check\nonly for the first line of the non-fast-forward warning - having that\nline should be enough assurance that the full warning is printed.\n\nIn the first place, grep can't deal with expressions for multiple\nlines.\n\nSigned-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n t/t5541-http-push.sh |   12 ++++--------\n 1 files changed, 4 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh\nindex 83a8e14..53f54a2 100755\n--- a/t/t5541-http-push.sh\n+++ b/t/t5541-http-push.sh\n@@ -105,10 +105,8 @@ test_expect_success 'non-fast-forward push show ref status' '\n '\n \n test_expect_success 'non-fast-forward push shows help message' '\n-\tgrep \\\n-\"To prevent you from losing history, non-fast-forward updates were rejected\n-Merge the remote changes before pushing again.  See the '\"'non-fast-forward'\"'\n-section of '\"'git push --help'\"' for details.\" output\n+\tgrep \"To prevent you from losing history, non-fast-forward updates were rejected\" \\\n+\t\toutput\n '\n \n test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' '\n@@ -126,10 +124,8 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he\n \tgrep \"^ + [a-f0-9]*\\.\\.\\.[a-f0-9]* *master -> master (forced update)$\" output &&\n \tgrep \"^ ! \\[rejected\\] *master -> retsam (non-fast-forward)$\" output &&\n \n-\tgrep \\\n-\"To prevent you from losing history, non-fast-forward updates were rejected\n-Merge the remote changes before pushing again.  See the '\"'non-fast-forward'\"'\n-section of '\"'git push --help'\"' for details.\" output\n+\tgrep \"To prevent you from losing history, non-fast-forward updates were rejected\" \\\n+\t\toutput\n '\n \n stop_httpd\n-- \n1.6.6\n"},{"id":"132610","messageId":"7v7hr63wm7.fsf@alter.siamese.dyndns.org","threadId":"22382","inReplyTo":"1264405343-2984-1-git-send-email-rctay89@gmail.com","subject":"Re: [PATCH] t5541-http-push: make grep expression check for one line only","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-25T17:47:12Z","receivedAt":"2010-01-25T17:47:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tay Ray Chuan <rctay89@gmail.com> writes:\n\n> Simplify the grep expressions in the non-fast-forward tests to check\n> only for the first line of the non-fast-forward warning - having that\n> line should be enough assurance that the full warning is printed.\n>\n> In the first place, grep can't deal with expressions for multiple\n> lines.\n\nThis shows that nobody has ever run this test since January 8th, not even\nthe original author?\n\nHmmm.\n\nThanks.\n\n>\n> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>\n> ---\n>  t/t5541-http-push.sh |   12 ++++--------\n>  1 files changed, 4 insertions(+), 8 deletions(-)\n>\n> diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh\n> index 83a8e14..53f54a2 100755\n> --- a/t/t5541-http-push.sh\n> +++ b/t/t5541-http-push.sh\n> @@ -105,10 +105,8 @@ test_expect_success 'non-fast-forward push show ref status' '\n>  '\n>  \n>  test_expect_success 'non-fast-forward push shows help message' '\n> -\tgrep \\\n> -\"To prevent you from losing history, non-fast-forward updates were rejected\n> -Merge the remote changes before pushing again.  See the '\"'non-fast-forward'\"'\n> -section of '\"'git push --help'\"' for details.\" output\n> +\tgrep \"To prevent you from losing history, non-fast-forward updates were rejected\" \\\n> +\t\toutput\n>  '\n>  \n>  test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' '\n> @@ -126,10 +124,8 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he\n>  \tgrep \"^ + [a-f0-9]*\\.\\.\\.[a-f0-9]* *master -> master (forced update)$\" output &&\n>  \tgrep \"^ ! \\[rejected\\] *master -> retsam (non-fast-forward)$\" output &&\n>  \n> -\tgrep \\\n> -\"To prevent you from losing history, non-fast-forward updates were rejected\n> -Merge the remote changes before pushing again.  See the '\"'non-fast-forward'\"'\n> -section of '\"'git push --help'\"' for details.\" output\n> +\tgrep \"To prevent you from losing history, non-fast-forward updates were rejected\" \\\n> +\t\toutput\n>  '\n>  \n>  stop_httpd\n> -- \n> 1.6.6\n"},{"id":"132612","messageId":"7v1vhe3wdz.fsf@alter.siamese.dyndns.org","threadId":"22382","inReplyTo":"7v7hr63wm7.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] t5541-http-push: make grep expression check for one line only","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-25T17:52:08Z","receivedAt":"2010-01-25T17:52:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Tay Ray Chuan <rctay89@gmail.com> writes:\n>\n>> Simplify the grep expressions in the non-fast-forward tests to check\n>> only for the first line of the non-fast-forward warning - having that\n>> line should be enough assurance that the full warning is printed.\n>>\n>> In the first place, grep can't deal with expressions for multiple\n>> lines.\n>\n> This shows that nobody has ever run this test since January 8th, not even\n> the original author?\n>\n> Hmmm.\n\nActually, if you grep with a pattern with multiple lines, it is equivalent\nto giving each of these lines as a separate pattern from the command line.\nSo it is understandable that the tests passed.  They were checking if\nthese match, but it doesn't check (and grep is not designed to) if the\nfirst pattern matched the first line, the second to second, etc.\n\nSo I'd say something like...\n\n    Don't feed multiple-line pattern to grep and expect them to match with\n    lines in order.\n\n    Simplify the grep expressions in the non-fast-forward tests to check\n    only for the first line of the non-fast-forward warning - having that\n    line should be enough assurance that the full warning is printed.\n\n    Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>\n\ninstead.\n"},{"id":"132658","messageId":"be6fef0d1001251733o57042a99q9f1f8b6e849187ee@mail.gmail.com","threadId":"22382","inReplyTo":"7v1vhe3wdz.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] t5541-http-push: make grep expression check for one line only","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-01-26T01:33:24Z","receivedAt":"2010-01-26T01:33:24Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Hi,\n\nOn Tue, Jan 26, 2010 at 1:52 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Tay Ray Chuan <rctay89@gmail.com> writes:\n>>\n>>> Simplify the grep expressions in the non-fast-forward tests to check\n>>> only for the first line of the non-fast-forward warning - having that\n>>> line should be enough assurance that the full warning is printed.\n>>>\n>>> In the first place, grep can't deal with expressions for multiple\n>>> lines.\n>>\n>> This shows that nobody has ever run this test since January 8th, not even\n>> the original author?\n>>\n>> Hmmm.\n>\n> Actually, if you grep with a pattern with multiple lines, it is equivalent\n> to giving each of these lines as a separate pattern from the command line.\n> So it is understandable that the tests passed.  They were checking if\n> these match, but it doesn't check (and grep is not designed to) if the\n> first pattern matched the first line, the second to second, etc.\n\nthat was why the tests passed then and passed now - I just happened to\nrun them, and I noticed grep reported success, yet only matched 2 of\nthe 3 lines. Then I remembered recently there had been a rewording of\nthe fast-forward warning was reworded (c0eb604 \"push: spell 'Note\nabout fast-forwards'\")...\n\n> So I'd say something like...\n>\n>    Don't feed multiple-line pattern to grep and expect them to match with\n>    lines in order.\n>\n>    Simplify the grep expressions in the non-fast-forward tests to check\n>    only for the first line of the non-fast-forward warning - having that\n>    line should be enough assurance that the full warning is printed.\n>\n>    Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>\n>\n> instead.\n\nNo problem.\n\n-- \nCheers,\nRay Chuan\n"},{"id":"132660","messageId":"1264469845-980-1-git-send-email-rctay89@gmail.com","threadId":"22382","inReplyTo":"be6fef0d1001251733o57042a99q9f1f8b6e849187ee@mail.gmail.com","subject":"[PATCH] t5541-http-push: make grep expression check for one line only","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-01-26T01:37:25Z","receivedAt":"2010-01-26T01:37:25Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Don't feed multiple-line pattern to grep and expect them to match with\nlines in order.\n\nSimplify the grep expressions in the non-fast-forward tests to check\nonly for the first line of the non-fast-forward warning - having that\nline should be enough assurance that the full warning is printed.\n\nSigned-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n t/t5541-http-push.sh |   12 ++++--------\n 1 files changed, 4 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh\nindex 83a8e14..53f54a2 100755\n--- a/t/t5541-http-push.sh\n+++ b/t/t5541-http-push.sh\n@@ -105,10 +105,8 @@ test_expect_success 'non-fast-forward push show ref status' '\n '\n \n test_expect_success 'non-fast-forward push shows help message' '\n-\tgrep \\\n-\"To prevent you from losing history, non-fast-forward updates were rejected\n-Merge the remote changes before pushing again.  See the '\"'non-fast-forward'\"'\n-section of '\"'git push --help'\"' for details.\" output\n+\tgrep \"To prevent you from losing history, non-fast-forward updates were rejected\" \\\n+\t\toutput\n '\n \n test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' '\n@@ -126,10 +124,8 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he\n \tgrep \"^ + [a-f0-9]*\\.\\.\\.[a-f0-9]* *master -> master (forced update)$\" output &&\n \tgrep \"^ ! \\[rejected\\] *master -> retsam (non-fast-forward)$\" output &&\n \n-\tgrep \\\n-\"To prevent you from losing history, non-fast-forward updates were rejected\n-Merge the remote changes before pushing again.  See the '\"'non-fast-forward'\"'\n-section of '\"'git push --help'\"' for details.\" output\n+\tgrep \"To prevent you from losing history, non-fast-forward updates were rejected\" \\\n+\t\toutput\n '\n \n stop_httpd\n-- \n1.6.6.1.436.gaba7d\n"}]}