{"thread":{"id":"28676","subject":"[PATCH] t7800: avoid arithmetic expansion notation","startedAt":"2011-10-14T12:15:31Z","lastAt":"2011-10-14T19:00:30Z","messageCount":3,"participants":["Michael J Gruber","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"177635","messageId":"837ad77348b459aa5f5f79e556dbeeeba41027e7.1318594392.git.git@drmicha.warpmail.net","threadId":"28676","inReplyTo":null,"subject":"[PATCH] t7800: avoid arithmetic expansion notation","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-10-14T12:15:31Z","receivedAt":"2011-10-14T12:15:31Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"ba959de (git-difftool: allow skipping file by typing 'n' at prompt, 2011-10-08)\nintroduced shell code like\n\n$((foo; bar) | baz)\n\nwhich some shells (e.g. bash, dash) interpret as an unfinished arithmetic\nevaluation $(( expr )).\n\nWrite this as\n\n$({foo; bar; } | baz)\n\nwhich is unambiguous and also avoids an unnecessary subshell.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n t/t7800-difftool.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh\nindex 7fc2b3a..76a8b70 100755\n--- a/t/t7800-difftool.sh\n+++ b/t/t7800-difftool.sh\n@@ -289,7 +289,7 @@ test_expect_success PERL 'setup with 2 files different' '\n '\n \n test_expect_success PERL 'say no to the first file' '\n-\tdiff=$((echo n; echo) | git difftool -x cat branch) &&\n+\tdiff=$({ echo n; echo; } | git difftool -x cat branch) &&\n \n \techo \"$diff\" | stdin_contains m2 &&\n \techo \"$diff\" | stdin_contains br2 &&\n@@ -298,7 +298,7 @@ test_expect_success PERL 'say no to the first file' '\n '\n \n test_expect_success PERL 'say no to the second file' '\n-\tdiff=$((echo; echo n) | git difftool -x cat branch) &&\n+\tdiff=$({ echo; echo n; } | git difftool -x cat branch) &&\n \n \techo \"$diff\" | stdin_contains master &&\n \techo \"$diff\" | stdin_contains branch &&\n-- \n1.7.7.338.g0156b\n"},{"id":"177658","messageId":"7v4nzb1mjd.fsf@alter.siamese.dyndns.org","threadId":"28676","inReplyTo":"837ad77348b459aa5f5f79e556dbeeeba41027e7.1318594392.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] t7800: avoid arithmetic expansion notation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-10-14T18:00:06Z","receivedAt":"2011-10-14T18:00:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> ba959de (git-difftool: allow skipping file by typing 'n' at prompt, 2011-10-08)\n> introduced shell code like\n>\n> $((foo; bar) | baz)\n>\n> which some shells (e.g. bash, dash) interpret as an unfinished arithmetic\n> evaluation $(( expr )).\n\nAhh, thanks, I should have caught this. I recall I rewrote a similar one\nto $( (command; command) | command ) more than once before.\n"},{"id":"177666","messageId":"7vfwivz9dd.fsf@alter.siamese.dyndns.org","threadId":"28676","inReplyTo":"7v4nzb1mjd.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] t7800: avoid arithmetic expansion notation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-10-14T19:00:30Z","receivedAt":"2011-10-14T19:00:30Z","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> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>\n>> ba959de (git-difftool: allow skipping file by typing 'n' at prompt, 2011-10-08)\n>> introduced shell code like\n>>\n>> $((foo; bar) | baz)\n>>\n>> which some shells (e.g. bash, dash) interpret as an unfinished arithmetic\n>> evaluation $(( expr )).\n>\n> Ahh, thanks, I should have caught this. I recall I rewrote a similar one\n> to $( (command; command) | command ) more than once before.\n\nForgot to mention that I love to see the issues on topics discovered and\ncorrected before they are still cooking in 'next', like this ;-)\n\nThanks all.\n"}]}