{"thread":{"id":"53057","subject":"[GSoC][PATCH 0/1] Microproject Submission","startedAt":"2020-03-22T12:46:39Z","lastAt":"2020-03-25T14:00:55Z","messageCount":7,"participants":["Shanthanu","Torsten Bögershausen","Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"393704","messageId":"20200322124619.30853-1-shanthanu.s.rai9@gmail.com","threadId":"53057","inReplyTo":null,"subject":"[GSoC][PATCH 0/1] Microproject Submission","fromName":"Shanthanu","fromEmail":"shanthanu.s.rai9@gmail.com","sentAt":"2020-03-22T12:46:18Z","receivedAt":"2020-03-22T12:46:39Z","isPatch":true,"sender":{"key":"shanthanu.s.rai9@gmail.com","avatar":"https://gravatar.com/avatar/609b002d0db85d343299e3e807bbb1c8eb333ac17aa7cc4069f93385600e5053?d=mp&s=160"},"body":"Hello! I am submitting this patch as part of my GSoC application.\n\nShanthanu (1):\n  t9116: avoid using pipes\n\n t/t9116-git-svn-log.sh | 36 ++++++++++++++++++++++++------------\n 1 file changed, 24 insertions(+), 12 deletions(-)\n\n-- \n2.26.0.rc2.28.g7fcb965970\n\n"},{"id":"393705","messageId":"20200322124619.30853-2-shanthanu.s.rai9@gmail.com","threadId":"53057","inReplyTo":"20200322124619.30853-1-shanthanu.s.rai9@gmail.com","subject":"[GSoC][PATCH 1/1] t9116: avoid using pipes","fromName":"Shanthanu","fromEmail":"shanthanu.s.rai9@gmail.com","sentAt":"2020-03-22T12:46:19Z","receivedAt":"2020-03-22T12:46:52Z","isPatch":true,"sender":{"key":"shanthanu.s.rai9@gmail.com","avatar":"https://gravatar.com/avatar/609b002d0db85d343299e3e807bbb1c8eb333ac17aa7cc4069f93385600e5053?d=mp&s=160"},"body":"Commit de26f02db1 (t9001, t9116: avoid pipes, 2020-02-14) noticed that\nwhen grepping through the output of a command, there is always a\nchance that something could go wrong.\n\nSo, redirect the output into a file and grep that file. Thus the log\ncan be inspected easily if the grep fails.\n\nSigned-off-by: Shanthanu <shanthanu.s.rai9@gmail.com>\n---\n\nIn test 'test ascending revision range with --show-commit (sha1)',\n'out1' variable is used since 'out' variable was already in use. \n\n t/t9116-git-svn-log.sh | 36 ++++++++++++++++++++++++------------\n 1 file changed, 24 insertions(+), 12 deletions(-)\n\ndiff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh\nindex 0a9f1ef366..d82aa0fab9 100755\n--- a/t/t9116-git-svn-log.sh\n+++ b/t/t9116-git-svn-log.sh\n@@ -61,12 +61,14 @@ printf 'r1 \\nr2 \\nr4 \\n' > expected-range-r1-r2-r4\n \n test_expect_success 'test ascending revision range' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n+\tgit svn log -r 1:4 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n \t\"\n \n test_expect_success 'test ascending revision range with --show-commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n+\tgit svn log --show-commit -r 1:4 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n \t\"\n \n test_expect_success 'test ascending revision range with --show-commit (sha1)' \"\n@@ -74,7 +76,8 @@ test_expect_success 'test ascending revision range with --show-commit (sha1)' \"\n \tgit svn find-rev r2 >>expected-range-r1-r2-r4-sha1 &&\n \tgit svn find-rev r4 >>expected-range-r1-r2-r4-sha1 &&\n \tgit reset --hard origin/trunk &&\n-\tgit svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f2 >out &&\n+\tgit svn log --show-commit -r 1:4 >out1 &&\n+\tgrep '^r[0-9]' out1 | cut -d'|' -f2 >out &&\n \tgit rev-parse \\$(cat out) >actual &&\n \ttest_cmp expected-range-r1-r2-r4-sha1 actual\n \t\"\n@@ -83,45 +86,52 @@ printf 'r4 \\nr2 \\nr1 \\n' > expected-range-r4-r2-r1\n \n test_expect_success 'test descending revision range' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -\n+\tgit svn log -r 4:1 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -\n \t\"\n \n printf 'r1 \\nr2 \\n' > expected-range-r1-r2\n \n test_expect_success 'test ascending revision range with unreachable revision' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -\n+\tgit svn log -r 1:3 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -\n \t\"\n \n printf 'r2 \\nr1 \\n' > expected-range-r2-r1\n \n test_expect_success 'test descending revision range with unreachable revision' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -\n+\tgit svn log -r 3:1 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -\n \t\"\n \n printf 'r2 \\n' > expected-range-r2\n \n test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -\n+\tgit svn log -r 2:3 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r2 -\n \t\"\n \n test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -\n+\tgit svn log -r 3:2 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r2 -\n \t\"\n \n printf 'r4 \\n' > expected-range-r4\n \n test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n+\tgit svn log -r 3:4 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n \t\"\n \n test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n+\tgit svn log -r 4:3 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n \t\"\n \n printf -- '------------------------------------------------------------------------\\n' > expected-separator\n@@ -138,12 +148,14 @@ test_expect_success 'test descending revision range with unreachable boundary re\n \n test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n+\tgit svn log -r 3:5 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n \t\"\n \n test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n+\tgit svn log -r 5:3 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n \t\"\n \n test_done\n-- \n2.26.0.rc2.28.g7fcb965970\n\n"},{"id":"393728","messageId":"20200322173616.wnz3umcxz25upv63@tb-raspi4","threadId":"53057","inReplyTo":"20200322124619.30853-2-shanthanu.s.rai9@gmail.com","subject":"Re: [GSoC][PATCH 1/1] t9116: avoid using pipes","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2020-03-22T17:36:16Z","receivedAt":"2020-03-22T17:36:22Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"Thanks for contributing to Git.\n\nOn Sun, Mar 22, 2020 at 06:16:19PM +0530, Shanthanu wrote:\n> Commit de26f02db1 (t9001, t9116: avoid pipes, 2020-02-14) noticed that\n> when grepping through the output of a command, there is always a\n> chance that something could go wrong.\n\nThat \"something could go wrong\" may deserve little bit more explanation\nin the commit message.\nOne thing when using pipes is that we may loose return codes of programs\nbeing part of the pipe.\nThe other thing is that it is hard to debug, if the test case fails.\nHaving the \"out\" file left on disk allows manual inspection, and tracking\ndown why it failed.\nHaving said this, we can make the test case even easier to debug, and consistant\nwith other test cases, please see below.\n\n>\n> So, redirect the output into a file and grep that file. Thus the log\n> can be inspected easily if the grep fails.\n>\n> Signed-off-by: Shanthanu <shanthanu.s.rai9@gmail.com>\n> ---\n>\n> In test 'test ascending revision range with --show-commit (sha1)',\n> 'out1' variable is used since 'out' variable was already in use.\n>\n>  t/t9116-git-svn-log.sh | 36 ++++++++++++++++++++++++------------\n>  1 file changed, 24 insertions(+), 12 deletions(-)\n>\n> diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh\n> index 0a9f1ef366..d82aa0fab9 100755\n> --- a/t/t9116-git-svn-log.sh\n> +++ b/t/t9116-git-svn-log.sh\n> @@ -61,12 +61,14 @@ printf 'r1 \\nr2 \\nr4 \\n' > expected-range-r1-r2-r4\n>\n>  test_expect_success 'test ascending revision range' \"\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n> +\tgit svn log -r 1:4 >out &&\n> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n\nThat could be written as\n\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n\ttest_cmp expected-range-r1-r2-r4 actual\n\nOr something in that style  (and similar below).\nWhat do you think ?\n\n>  \t\"\n>\n>  test_expect_success 'test ascending revision range with --show-commit' \"\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n> +\tgit svn log --show-commit -r 1:4 >out &&\n> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n>  \t\"\n>\n>  test_expect_success 'test ascending revision range with --show-commit (sha1)' \"\n> @@ -74,7 +76,8 @@ test_expect_success 'test ascending revision range with --show-commit (sha1)' \"\n>  \tgit svn find-rev r2 >>expected-range-r1-r2-r4-sha1 &&\n>  \tgit svn find-rev r4 >>expected-range-r1-r2-r4-sha1 &&\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f2 >out &&\n> +\tgit svn log --show-commit -r 1:4 >out1 &&\n> +\tgrep '^r[0-9]' out1 | cut -d'|' -f2 >out &&\n>  \tgit rev-parse \\$(cat out) >actual &&\n>  \ttest_cmp expected-range-r1-r2-r4-sha1 actual\n>  \t\"\n> @@ -83,45 +86,52 @@ printf 'r4 \\nr2 \\nr1 \\n' > expected-range-r4-r2-r1\n>\n>  test_expect_success 'test descending revision range' \"\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -\n> +\tgit svn log -r 4:1 >out &&\n> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -\n>  \t\"\n>\n>  printf 'r1 \\nr2 \\n' > expected-range-r1-r2\n>\n>  test_expect_success 'test ascending revision range with unreachable revision' \"\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -\n> +\tgit svn log -r 1:3 >out &&\n> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -\n>  \t\"\n>\n>  printf 'r2 \\nr1 \\n' > expected-range-r2-r1\n>\n>  test_expect_success 'test descending revision range with unreachable revision' \"\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -\n> +\tgit svn log -r 3:1 >out &&\n> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -\n>  \t\"\n>\n>  printf 'r2 \\n' > expected-range-r2\n>\n>  test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' \"\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -\n> +\tgit svn log -r 2:3 >out &&\n> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r2 -\n>  \t\"\n>\n>  test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' \"\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -\n> +\tgit svn log -r 3:2 >out &&\n> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r2 -\n>  \t\"\n>\n>  printf 'r4 \\n' > expected-range-r4\n>\n>  test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' \"\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n> +\tgit svn log -r 3:4 >out &&\n> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>  \t\"\n>\n>  test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' \"\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n> +\tgit svn log -r 4:3 >out &&\n> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>  \t\"\n>\n>  printf -- '------------------------------------------------------------------------\\n' > expected-separator\n> @@ -138,12 +148,14 @@ test_expect_success 'test descending revision range with unreachable boundary re\n>\n>  test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' \"\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n> +\tgit svn log -r 3:5 >out &&\n> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>  \t\"\n>\n>  test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' \"\n>  \tgit reset --hard origin/trunk &&\n> -\tgit svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n> +\tgit svn log -r 5:3 >out &&\n> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>  \t\"\n>\n>  test_done\n> --\n> 2.26.0.rc2.28.g7fcb965970\n>\n"},{"id":"393756","messageId":"3f490717-fd3c-6c20-6a47-51b84b4c4860@gmail.com","threadId":"53057","inReplyTo":"20200322173616.wnz3umcxz25upv63@tb-raspi4","subject":"Re: [GSoC][PATCH 1/1] t9116: avoid using pipes","fromName":"Shanthanu","fromEmail":"shanthanu.s.rai9@gmail.com","sentAt":"2020-03-23T07:04:16Z","receivedAt":"2020-03-23T07:04:29Z","isPatch":true,"sender":{"key":"shanthanu.s.rai9@gmail.com","avatar":"https://gravatar.com/avatar/609b002d0db85d343299e3e807bbb1c8eb333ac17aa7cc4069f93385600e5053?d=mp&s=160"},"body":"Thanks for the review!\n\nOn 22/03/20 11:06 pm, Torsten Bögershausen wrote:\n>> Commit de26f02db1 (t9001, t9116: avoid pipes, 2020-02-14) noticed that\n>> when grepping through the output of a command, there is always a\n>> chance that something could go wrong.\n> That \"something could go wrong\" may deserve little bit more explanation\n> in the commit message.\n> One thing when using pipes is that we may loose return codes of programs\n> being part of the pipe.\n> The other thing is that it is hard to debug, if the test case fails.\n> Having the \"out\" file left on disk allows manual inspection, and tracking\n> down why it failed.\n\nYeah makes sense. I will update the commit message by adding the above\ndetails.\n\n> Having said this, we can make the test case even easier to debug, and consistant\n> with other test cases, please see below.\n>\n>> So, redirect the output into a file and grep that file. Thus the log\n>> can be inspected easily if the grep fails.\n>>\n>> Signed-off-by: Shanthanu <shanthanu.s.rai9@gmail.com>\n>> ---\n>>\n>> In test 'test ascending revision range with --show-commit (sha1)',\n>> 'out1' variable is used since 'out' variable was already in use.\n>>\n>>  t/t9116-git-svn-log.sh | 36 ++++++++++++++++++++++++------------\n>>  1 file changed, 24 insertions(+), 12 deletions(-)\n>>\n>> diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh\n>> index 0a9f1ef366..d82aa0fab9 100755\n>> --- a/t/t9116-git-svn-log.sh\n>> +++ b/t/t9116-git-svn-log.sh\n>> @@ -61,12 +61,14 @@ printf 'r1 \\nr2 \\nr4 \\n' > expected-range-r1-r2-r4\n>>\n>>  test_expect_success 'test ascending revision range' \"\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n>> +\tgit svn log -r 1:4 >out &&\n>> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n> That could be written as\n> \tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n> \ttest_cmp expected-range-r1-r2-r4 actual\n>\n> Or something in that style  (and similar below).\n> What do you think ?\n>\n>>  \t\"\n>>\n>>  test_expect_success 'test ascending revision range with --show-commit' \"\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n>> +\tgit svn log --show-commit -r 1:4 >out &&\n>> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n>>  \t\"\n>>\n>>  test_expect_success 'test ascending revision range with --show-commit (sha1)' \"\n>> @@ -74,7 +76,8 @@ test_expect_success 'test ascending revision range with --show-commit (sha1)' \"\n>>  \tgit svn find-rev r2 >>expected-range-r1-r2-r4-sha1 &&\n>>  \tgit svn find-rev r4 >>expected-range-r1-r2-r4-sha1 &&\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f2 >out &&\n>> +\tgit svn log --show-commit -r 1:4 >out1 &&\n>> +\tgrep '^r[0-9]' out1 | cut -d'|' -f2 >out &&\n>>  \tgit rev-parse \\$(cat out) >actual &&\n>>  \ttest_cmp expected-range-r1-r2-r4-sha1 actual\n>>  \t\"\n>> @@ -83,45 +86,52 @@ printf 'r4 \\nr2 \\nr1 \\n' > expected-range-r4-r2-r1\n>>\n>>  test_expect_success 'test descending revision range' \"\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -\n>> +\tgit svn log -r 4:1 >out &&\n>> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -\n>>  \t\"\n>>\n>>  printf 'r1 \\nr2 \\n' > expected-range-r1-r2\n>>\n>>  test_expect_success 'test ascending revision range with unreachable revision' \"\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -\n>> +\tgit svn log -r 1:3 >out &&\n>> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -\n>>  \t\"\n>>\n>>  printf 'r2 \\nr1 \\n' > expected-range-r2-r1\n>>\n>>  test_expect_success 'test descending revision range with unreachable revision' \"\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -\n>> +\tgit svn log -r 3:1 >out &&\n>> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -\n>>  \t\"\n>>\n>>  printf 'r2 \\n' > expected-range-r2\n>>\n>>  test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' \"\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -\n>> +\tgit svn log -r 2:3 >out &&\n>> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r2 -\n>>  \t\"\n>>\n>>  test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' \"\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -\n>> +\tgit svn log -r 3:2 >out &&\n>> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r2 -\n>>  \t\"\n>>\n>>  printf 'r4 \\n' > expected-range-r4\n>>\n>>  test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' \"\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>> +\tgit svn log -r 3:4 >out &&\n>> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>>  \t\"\n>>\n>>  test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' \"\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>> +\tgit svn log -r 4:3 >out &&\n>> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>>  \t\"\n>>\n>>  printf -- '------------------------------------------------------------------------\\n' > expected-separator\n>> @@ -138,12 +148,14 @@ test_expect_success 'test descending revision range with unreachable boundary re\n>>\n>>  test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' \"\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>> +\tgit svn log -r 3:5 >out &&\n>> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>>  \t\"\n>>\n>>  test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' \"\n>>  \tgit reset --hard origin/trunk &&\n>> -\tgit svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>> +\tgit svn log -r 5:3 >out &&\n>> +\tgrep '^r[0-9]' out | cut -d'|' -f1 | test_cmp expected-range-r4 -\n>>  \t\"\n>>\n>>  test_done\n>> --\n>> 2.26.0.rc2.28.g7fcb965970\n>>\nYeah, this looks good! I will add these changes in the next patch version.\n"},{"id":"393871","messageId":"20200324093502.32394-1-shanthanu.s.rai9@gmail.com","threadId":"53057","inReplyTo":"20200322124619.30853-1-shanthanu.s.rai9@gmail.com","subject":"[PATCH v2] t9116: avoid using pipes","fromName":"Shanthanu","fromEmail":"shanthanu.s.rai9@gmail.com","sentAt":"2020-03-24T09:35:02Z","receivedAt":"2020-03-24T09:35:30Z","isPatch":true,"sender":{"key":"shanthanu.s.rai9@gmail.com","avatar":"https://gravatar.com/avatar/609b002d0db85d343299e3e807bbb1c8eb333ac17aa7cc4069f93385600e5053?d=mp&s=160"},"body":"Commit c6f44e1da5 (t9813: avoid using pipes, 2017-01-04) recommends to\navoid using pipes, since the exit code of upstream in the pipe is\nignored. Hence, redirect the output to a file and parse that file.\n\nCommit de26f02db1 (t9001, t9116: avoid pipes, 2020-02-14) noted that\nthis also allows easy debugging in case the test fails, since the file\nwill be left on disk and can be manually inspected.\n\nSigned-off-by: Shanthanu <shanthanu.s.rai9@gmail.com>\n---\n t/t9116-git-svn-log.sh | 53 +++++++++++++++++++++++++++++++-----------\n 1 file changed, 39 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh\nindex 0a9f1ef366..56d68e4aed 100755\n--- a/t/t9116-git-svn-log.sh\n+++ b/t/t9116-git-svn-log.sh\n@@ -61,12 +61,16 @@ printf 'r1 \\nr2 \\nr4 \\n' > expected-range-r1-r2-r4\n \n test_expect_success 'test ascending revision range' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n+\tgit svn log -r 1:4 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n+\ttest_cmp expected-range-r1-r2-r4 actual\n \t\"\n \n test_expect_success 'test ascending revision range with --show-commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n+\tgit svn log --show-commit -r 1:4 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n+\ttest_cmp expected-range-r1-r2-r4 actual\n \t\"\n \n test_expect_success 'test ascending revision range with --show-commit (sha1)' \"\n@@ -74,7 +78,8 @@ test_expect_success 'test ascending revision range with --show-commit (sha1)' \"\n \tgit svn find-rev r2 >>expected-range-r1-r2-r4-sha1 &&\n \tgit svn find-rev r4 >>expected-range-r1-r2-r4-sha1 &&\n \tgit reset --hard origin/trunk &&\n-\tgit svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f2 >out &&\n+\tgit svn log --show-commit -r 1:4 >out1 &&\n+\tgrep '^r[0-9]' out1 | cut -d'|' -f2 >out &&\n \tgit rev-parse \\$(cat out) >actual &&\n \ttest_cmp expected-range-r1-r2-r4-sha1 actual\n \t\"\n@@ -83,67 +88,87 @@ printf 'r4 \\nr2 \\nr1 \\n' > expected-range-r4-r2-r1\n \n test_expect_success 'test descending revision range' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -\n+\tgit svn log -r 4:1 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n+\ttest_cmp expected-range-r4-r2-r1 actual\n \t\"\n \n printf 'r1 \\nr2 \\n' > expected-range-r1-r2\n \n test_expect_success 'test ascending revision range with unreachable revision' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -\n+\tgit svn log -r 1:3 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n+\ttest_cmp expected-range-r1-r2 actual\n \t\"\n \n printf 'r2 \\nr1 \\n' > expected-range-r2-r1\n \n test_expect_success 'test descending revision range with unreachable revision' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -\n+\tgit svn log -r 3:1 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n+\ttest_cmp expected-range-r2-r1 actual\n \t\"\n \n printf 'r2 \\n' > expected-range-r2\n \n test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -\n+\tgit svn log -r 2:3 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n+\ttest_cmp expected-range-r2 actual\n \t\"\n \n test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -\n+\tgit svn log -r 3:2 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n+\ttest_cmp expected-range-r2 actual\n \t\"\n \n printf 'r4 \\n' > expected-range-r4\n \n test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n+\tgit svn log -r 3:4 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n+\ttest_cmp expected-range-r4 actual\n \t\"\n \n test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n+\tgit svn log -r 4:3 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n+\ttest_cmp expected-range-r4 actual\n \t\"\n \n printf -- '------------------------------------------------------------------------\\n' > expected-separator\n \n test_expect_success 'test ascending revision range with unreachable boundary revisions and no commits' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 5:6 | test_cmp expected-separator -\n+\tgit svn log -r 5:6 >actual &&\n+\ttest_cmp expected-separator actual\n \t\"\n \n test_expect_success 'test descending revision range with unreachable boundary revisions and no commits' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 6:5 | test_cmp expected-separator -\n+\tgit svn log -r 6:5 >actual &&\n+\ttest_cmp expected-separator actual\n \t\"\n \n test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n+\tgit svn log -r 3:5 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n+\ttest_cmp expected-range-r4 actual\n \t\"\n \n test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' \"\n \tgit reset --hard origin/trunk &&\n-\tgit svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -\n+\tgit svn log -r 5:3 >out &&\n+\tgrep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n+\ttest_cmp expected-range-r4 actual\n \t\"\n \n test_done\n-- \n2.26.0.rc2.28.g7fcb965970\n\n"},{"id":"393882","messageId":"CAP8UFD2Uu-dPJcZB--T7k0tMuXc0iVeqnMUn3Y_x+3iaFf9xFQ@mail.gmail.com","threadId":"53057","inReplyTo":"20200324093502.32394-1-shanthanu.s.rai9@gmail.com","subject":"Re: [PATCH v2] t9116: avoid using pipes","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2020-03-24T18:34:02Z","receivedAt":"2020-03-24T18:34:17Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Tue, Mar 24, 2020 at 10:36 AM Shanthanu <shanthanu.s.rai9@gmail.com> wrote:\n>\n> Commit c6f44e1da5 (t9813: avoid using pipes, 2017-01-04) recommends to\n> avoid using pipes, since the exit code of upstream in the pipe is\n> ignored. Hence, redirect the output to a file and parse that file.\n>\n> Commit de26f02db1 (t9001, t9116: avoid pipes, 2020-02-14) noted that\n> this also allows easy debugging in case the test fails, since the file\n> will be left on disk and can be manually inspected.\n>\n> Signed-off-by: Shanthanu <shanthanu.s.rai9@gmail.com>\n\nWe usually ask for a legal name in a format similar to \"<Firstname>\n<MaybeMiddleNameInitial> <Lastname>\" where <MaybeMiddleNameInitial>\ncan be omitted. The name should also match what is in the \"From:\"\nfield of the emails you send.\n\n> ---\n>  t/t9116-git-svn-log.sh | 53 +++++++++++++++++++++++++++++++-----------\n>  1 file changed, 39 insertions(+), 14 deletions(-)\n>\n> diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh\n> index 0a9f1ef366..56d68e4aed 100755\n> --- a/t/t9116-git-svn-log.sh\n> +++ b/t/t9116-git-svn-log.sh\n> @@ -61,12 +61,16 @@ printf 'r1 \\nr2 \\nr4 \\n' > expected-range-r1-r2-r4\n>\n>  test_expect_success 'test ascending revision range' \"\n>         git reset --hard origin/trunk &&\n> -       git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n> +       git svn log -r 1:4 >out &&\n> +       grep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n> +       test_cmp expected-range-r1-r2-r4 actual\n>         \"\n\nIt seems that the code that your patch changes is repeated a lot in\nthis test script. I wonder if it would be better to write a shell\nfunction to avoid those repetitions.\n"},{"id":"393966","messageId":"4b40a756-c32f-64ad-1e1d-4e31804d8295@gmail.com","threadId":"53057","inReplyTo":"CAP8UFD2Uu-dPJcZB--T7k0tMuXc0iVeqnMUn3Y_x+3iaFf9xFQ@mail.gmail.com","subject":"Re: [PATCH v2] t9116: avoid using pipes","fromName":"Shanthanu","fromEmail":"shanthanu.s.rai9@gmail.com","sentAt":"2020-03-25T14:00:45Z","receivedAt":"2020-03-25T14:00:55Z","isPatch":true,"sender":{"key":"shanthanu.s.rai9@gmail.com","avatar":"https://gravatar.com/avatar/609b002d0db85d343299e3e807bbb1c8eb333ac17aa7cc4069f93385600e5053?d=mp&s=160"},"body":"\nOn 25/03/20 12:04 am, Christian Couder wrote:\n> On Tue, Mar 24, 2020 at 10:36 AM Shanthanu <shanthanu.s.rai9@gmail.com> wrote:\n>> Commit c6f44e1da5 (t9813: avoid using pipes, 2017-01-04) recommends to\n>> avoid using pipes, since the exit code of upstream in the pipe is\n>> ignored. Hence, redirect the output to a file and parse that file.\n>>\n>> Commit de26f02db1 (t9001, t9116: avoid pipes, 2020-02-14) noted that\n>> this also allows easy debugging in case the test fails, since the file\n>> will be left on disk and can be manually inspected.\n>>\n>> Signed-off-by: Shanthanu <shanthanu.s.rai9@gmail.com>\n> We usually ask for a legal name in a format similar to \"<Firstname>\n> <MaybeMiddleNameInitial> <Lastname>\" where <MaybeMiddleNameInitial>\n> can be omitted. The name should also match what is in the \"From:\"\n> field of the emails you send.\nOkay, I will keep that in mind.\n>> ---\n>>  t/t9116-git-svn-log.sh | 53 +++++++++++++++++++++++++++++++-----------\n>>  1 file changed, 39 insertions(+), 14 deletions(-)\n>>\n>> diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh\n>> index 0a9f1ef366..56d68e4aed 100755\n>> --- a/t/t9116-git-svn-log.sh\n>> +++ b/t/t9116-git-svn-log.sh\n>> @@ -61,12 +61,16 @@ printf 'r1 \\nr2 \\nr4 \\n' > expected-range-r1-r2-r4\n>>\n>>  test_expect_success 'test ascending revision range' \"\n>>         git reset --hard origin/trunk &&\n>> -       git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -\n>> +       git svn log -r 1:4 >out &&\n>> +       grep '^r[0-9]' out | cut -d'|' -f1 >actual &&\n>> +       test_cmp expected-range-r1-r2-r4 actual\n>>         \"\n> It seems that the code that your patch changes is repeated a lot in\n> this test script. I wonder if it would be better to write a shell\n> function to avoid those repetitions.\n\nOh yeah, that would be better. I will add a function. Just clarifying,\nthe function should run the git, grep, cut and test_cmp commands?\n\nAlso, could you suggest an appropriate name for this function?\n\n"}]}