{"thread":{"id":"36080","subject":"[PATCH] *.sh: drop useless use of \"env\"","startedAt":"2014-03-06T23:20:17Z","lastAt":"2014-03-07T01:14:31Z","messageCount":2,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"236219","messageId":"xmqq1tyex6by.fsf@gitster.dls.corp.google.com","threadId":"36080","inReplyTo":null,"subject":"[PATCH] *.sh: drop useless use of \"env\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-06T23:20:17Z","receivedAt":"2014-03-06T23:20:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"In a bourne shell script, \"VAR=VAL command\" is sufficient to run\n'command' with environment variable VAR set to value VAL without\naffecting the environment of the shell itself; there is no reason to\nsay \"env VAR=VAL command\".\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * Just something I noticed while reading existing tests...\n\n t/t1020-subdirectory.sh | 2 +-\n t/t9001-send-email.sh   | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh\nindex 1e2945e..6902320 100755\n--- a/t/t1020-subdirectory.sh\n+++ b/t/t1020-subdirectory.sh\n@@ -148,7 +148,7 @@ test_expect_success 'GIT_PREFIX for built-ins' '\n \t(\n \t\tcd dir &&\n \t\tprintf \"change\" >two &&\n-\t\tenv GIT_EXTERNAL_DIFF=./diff git diff >../actual\n+\t\tGIT_EXTERNAL_DIFF=./diff git diff >../actual\n \t\tgit checkout -- two\n \t) &&\n \ttest_cmp expect actual\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 3119c8c..1ecdacb 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -409,7 +409,7 @@ test_expect_success $PREREQ 'Valid In-Reply-To when prompting' '\n \t(echo \"From Example <from@example.com>\"\n \t echo \"To Example <to@example.com>\"\n \t echo \"\"\n-\t) | env GIT_SEND_EMAIL_NOTTY=1 git send-email \\\n+\t) | GIT_SEND_EMAIL_NOTTY=1 git send-email \\\n \t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n \t\t$patches 2>errors &&\n \t! grep \"^In-Reply-To: < *>\" msgtxt1\n\n\n\t\n"},{"id":"236227","messageId":"xmqqfvmuvmh4.fsf@gitster.dls.corp.google.com","threadId":"36080","inReplyTo":"xmqq1tyex6by.fsf@gitster.dls.corp.google.com","subject":"[micro] Use 'env' on test_must_fail as appropriate","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-07T01:14:31Z","receivedAt":"2014-03-07T01:14:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Because \"VAR=VAL command\" is sufficient to run 'command' with\nenvironment variable VAR set to value VAL without affecting the\nenvironment of the shell itself, but we cannot do the same with a\nshell function (most notably, \"test_must_fail\"), we have subshell\ninvocations with multiple lines like this:\n\n\t... &&\n\t(\n        \tVAR=VAL &&\n                export VAR &&\n                test_must_fail git command\n\t) &&\n        ...\n\nwhich could be expressed as\n\n\t... &&\n        test_must_fail env VAR=VAL git comand &&\n\t...\n\nFind and shorten such constructs in existing test scripts.\n\nNote that I am not 100% convinced myself that it is a good idea to\ndo this, so please do not add this to the list without seeing it\ndiscussed.\n\nThanks.\n"}]}