{"thread":{"id":"25375","subject":"[PATCH] t/t5560: use `X=Y && export X' not `export X=Y'","startedAt":"2010-10-07T07:47:14Z","lastAt":"2010-10-13T18:36:21Z","messageCount":5,"participants":["Ævar Arnfjörð Bjarmason","Matthieu Moy","Clemens Buchacher","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"152854","messageId":"1286437634-12593-1-git-send-email-avarab@gmail.com","threadId":"25375","inReplyTo":null,"subject":"[PATCH] t/t5560: use `X=Y && export X' not `export X=Y'","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-10-07T07:47:14Z","receivedAt":"2010-10-07T07:47:14Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change t/t5560-http-backend-noserver.sh to use the `X=Y && export X'\nstyle instead of `export X=Y'. The latter doesn't work on all POSIX\nshells.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t5560-http-backend-noserver.sh |   17 ++++++++++++-----\n 1 files changed, 12 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5560-http-backend-noserver.sh b/t/t5560-http-backend-noserver.sh\nindex 406432e..effe797 100755\n--- a/t/t5560-http-backend-noserver.sh\n+++ b/t/t5560-http-backend-noserver.sh\n@@ -5,7 +5,11 @@ test_description='test git-http-backend-noserver'\n \n HTTPD_DOCUMENT_ROOT_PATH=\"$TRASH_DIRECTORY\"\n \n-test_have_prereq MINGW && export GREP_OPTIONS=-U\n+if test_have_prereq MINGW\n+then\n+\tGREP_OPTIONS=-U\n+\texport GREP_OPTIONS\n+fi\n \n run_backend() {\n \techo \"$2\" |\n@@ -15,7 +19,8 @@ run_backend() {\n }\n \n GET() {\n-\texport REQUEST_METHOD=\"GET\" &&\n+\tREQUEST_METHOD=\"GET\" &&\n+\texport REQUEST_METHOD &&\n \trun_backend \"/repo.git/$1\" &&\n \tunset REQUEST_METHOD &&\n \tif ! grep \"Status\" act.out >act\n@@ -27,8 +32,9 @@ GET() {\n }\n \n POST() {\n-\texport REQUEST_METHOD=\"POST\" &&\n-\texport CONTENT_TYPE=\"application/x-$1-request\" &&\n+\tREQUEST_METHOD=\"POST\" &&\n+\tCONTENT_TYPE=\"application/x-$1-request\" &&\n+\texport REQUEST_METHOD CONTENT_TYPE &&\n \trun_backend \"/repo.git/$1\" \"$2\" &&\n \tunset REQUEST_METHOD &&\n \tunset CONTENT_TYPE &&\n@@ -47,7 +53,8 @@ log_div() {\n . \"$TEST_DIRECTORY\"/t556x_common\n \n expect_aliased() {\n-\texport REQUEST_METHOD=\"GET\" &&\n+\tREQUEST_METHOD=\"GET\" &&\n+\texport REQUEST_METHOD &&\n \tif test $1 = 0; then\n \t\trun_backend \"$2\"\n \telse\n-- \n1.7.3.1.50.g1e633\n"},{"id":"152855","messageId":"vpqhbgy8mjj.fsf@bauges.imag.fr","threadId":"25375","inReplyTo":"1286437634-12593-1-git-send-email-avarab@gmail.com","subject":"Re: [PATCH] t/t5560: use `X=Y && export X' not `export X=Y'","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-10-07T07:55:12Z","receivedAt":"2010-10-07T07:55:12Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> Change t/t5560-http-backend-noserver.sh to use the `X=Y && export X'\n> style instead of `export X=Y'. The latter doesn't work on all POSIX\n> shells.\n\nAccording to\n\ngit grep '\\<export [A-Za-z_]*='\n\nthere seem to be a couple of other instances of this.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"152856","messageId":"AANLkTi=cMYoLVipaiFajcssrRBVPX5NXFNwj21Ji3Lru@mail.gmail.com","threadId":"25375","inReplyTo":"vpqhbgy8mjj.fsf@bauges.imag.fr","subject":"Re: [PATCH] t/t5560: use `X=Y && export X' not `export X=Y'","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-10-07T08:09:34Z","receivedAt":"2010-10-07T08:09:34Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Thu, Oct 7, 2010 at 07:55, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> wrote:\n> Ęvar Arnfjörš Bjarmason <avarab@gmail.com> writes:\n>\n>> Change t/t5560-http-backend-noserver.sh to use the `X=Y && export X'\n>> style instead of `export X=Y'. The latter doesn't work on all POSIX\n>> shells.\n>\n> According to\n>\n> git grep '\\<export [A-Za-z_]*='\n>\n> there seem to be a couple of other instances of this.\n\nYeah, the ones in Documentation/*.txt are OK IMO. The users reading\nthe docs probably don't have a shell old enough to complain about\nthis.\n\nLikewise for contrib/hg-to-git/hg-to-git.py and gitweb/INSTALL.\n\nThese we probably want to fix:\n\n    git-am.sh:          export GIT_MERGE_VERBOSITY=0\n    git-rebase.sh:          export GIT_MERGE_VERBOSITY=1\n    git-stash.sh:           export GIT_MERGE_VERBOSITY=0\n\nand maybe this:\n\n    git-gui/lib/shortcut.tcl:                               puts $fd\n\"export PATH=[sq [file dirname $::_git]]:\\$PATH &&\"\n\nThis is the only other thing in the test suite:\n\n    t/t1509-root-worktree.sh:export GIT_DIR=\"$TRASH_DIRECTORY/.git\"\n    t/t1509-root-worktree.sh:export GIT_WORK_TREE=/\n    t/t1509-root-worktree.sh:export GIT_DIR=\"$(echo\n$TRASH_DIRECTORY|sed 's,^/,,')/.git\"\n\nBut I didn't touch that since nobody runs that test anyway, and if\nthey do having a strict POSIX shell is the least of their problems.\n"},{"id":"153149","messageId":"20101010172011.GB15495@localhost","threadId":"25375","inReplyTo":"AANLkTi=cMYoLVipaiFajcssrRBVPX5NXFNwj21Ji3Lru@mail.gmail.com","subject":"Re: [PATCH] t/t5560: use `X=Y && export X' not `export X=Y'","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-10-10T17:20:11Z","receivedAt":"2010-10-10T17:20:11Z","isPatch":true,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Thu, Oct 07, 2010 at 08:09:34AM +0000, Ævar Arnfjörð Bjarmason wrote:\n> >\n> > According to\n> >\n> > git grep '\\<export [A-Za-z_]*='\n> >\n> > there seem to be a couple of other instances of this.\n\nWhat about t556x_common?\n\n export GIT_HTTP_EXPORT_ALL=1\n\nClemens\n"},{"id":"153425","messageId":"7vd3relz2y.fsf@alter.siamese.dyndns.org","threadId":"25375","inReplyTo":"1286437634-12593-1-git-send-email-avarab@gmail.com","subject":"Re: [PATCH] t/t5560: use `X=Y && export X' not `export X=Y'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-10-13T18:36:21Z","receivedAt":"2010-10-13T18:36:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Let's do this instead.\n\n * One patch to clean things up in all of 'maint';\n * Another to clean the remainder that are in 'master'.\n\nHere is the one for 'maint' to make the output from\n\n    $ git grep '^[ \t]*export .*=' -- '*.sh'\n\nempty.\n\n-- >8 --\nSubject: shell portability: no \"export VAR=VAL\"\n\nIt is more portable to say \"VAR=VAL && export VAR\" instead.\n\nNoticed by Ævar.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n git-am.sh                        |    2 +-\n git-rebase.sh                    |    2 +-\n git-stash.sh                     |    2 +-\n t/t1509-root-worktree.sh         |   28 ++++++++++++++--------------\n t/t5560-http-backend-noserver.sh |    8 ++++----\n t/t556x_common                   |    4 ++--\n 6 files changed, 23 insertions(+), 23 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex e7f008c..5f24948 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -137,7 +137,7 @@ It does not apply to blobs recorded in its index.\"\n     export GITHEAD_$his_tree\n     if test -n \"$GIT_QUIET\"\n     then\n-\t    export GIT_MERGE_VERBOSITY=0\n+\t    GIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY\n     fi\n     git-merge-recursive $orig_tree -- HEAD $his_tree || {\n \t    git rerere $allow_rerere_autoupdate\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 3335cee..e5df23b 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -111,7 +111,7 @@ call_merge () {\n \texport GITHEAD_$cmt GITHEAD_$hd\n \tif test -n \"$GIT_QUIET\"\n \tthen\n-\t\texport GIT_MERGE_VERBOSITY=1\n+\t\tGIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY\n \tfi\n \teval 'git-merge-$strategy' $strategy_opts '\"$cmt^\" -- \"$hd\" \"$cmt\"'\n \trv=$?\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 5fb1245..7561b37 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -373,7 +373,7 @@ apply_stash () {\n \n \tif test -n \"$GIT_QUIET\"\n \tthen\n-\t\texport GIT_MERGE_VERBOSITY=0\n+\t\tGIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY\n \tfi\n \tif git merge-recursive $b_tree -- $c_tree $w_tree\n \tthen\ndiff --git a/t/t1509-root-worktree.sh b/t/t1509-root-worktree.sh\nindex 7f60fd0..335420f 100755\n--- a/t/t1509-root-worktree.sh\n+++ b/t/t1509-root-worktree.sh\n@@ -134,8 +134,8 @@ cat >ls.expected <<EOF\n 100644 $ONE_SHA1 0\tme\n EOF\n \n-export GIT_DIR=\"$TRASH_DIRECTORY/.git\"\n-export GIT_WORK_TREE=/\n+GIT_DIR=\"$TRASH_DIRECTORY/.git\" && export GIT_DIR\n+GIT_WORK_TREE=/ && export GIT_WORK_TREE\n \n test_vars 'abs gitdir, root' \"$GIT_DIR\" \"/\" \"\"\n test_foobar_root\n@@ -154,24 +154,24 @@ say \"GIT_DIR relative, GIT_WORK_TREE set\"\n \n test_expect_success 'go to /' 'cd /'\n \n-export GIT_DIR=\"$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git\"\n-export GIT_WORK_TREE=/\n+GIT_DIR=\"$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git\" && export GIT_DIR\n+GIT_WORK_TREE=/ && export GIT_WORK_TREE\n \n test_vars 'rel gitdir, root' \"$GIT_DIR\" \"/\" \"\"\n test_foobar_root\n \n test_expect_success 'go to /foo' 'cd /foo'\n \n-export GIT_DIR=\"../$TRASH_DIRECTORY/.git\"\n-export GIT_WORK_TREE=/\n+GIT_DIR=\"../$TRASH_DIRECTORY/.git\" && export GIT_DIR\n+GIT_WORK_TREE=/ && export GIT_WORK_TREE\n \n test_vars 'rel gitdir, foo' \"$TRASH_DIRECTORY/.git\" \"/\" \"foo/\"\n test_foobar_foo\n \n test_expect_success 'go to /foo/bar' 'cd /foo/bar'\n \n-export GIT_DIR=\"../../$TRASH_DIRECTORY/.git\"\n-export GIT_WORK_TREE=/\n+GIT_DIR=\"../../$TRASH_DIRECTORY/.git\" && export GIT_DIR\n+GIT_WORK_TREE=/ && export GIT_WORK_TREE\n \n test_vars 'rel gitdir, foo/bar' \"$TRASH_DIRECTORY/.git\" \"/\" \"foo/bar/\"\n test_foobar_foobar\n@@ -180,24 +180,24 @@ say \"GIT_DIR relative, GIT_WORK_TREE relative\"\n \n test_expect_success 'go to /' 'cd /'\n \n-export GIT_DIR=\"$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git\"\n-export GIT_WORK_TREE=.\n+GIT_DIR=\"$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git\" && export GIT_DIR\n+GIT_WORK_TREE=. && export GIT_WORK_TREE\n \n test_vars 'rel gitdir, root' \"$GIT_DIR\" \"/\" \"\"\n test_foobar_root\n \n test_expect_success 'go to /' 'cd /foo'\n \n-export GIT_DIR=\"../$TRASH_DIRECTORY/.git\"\n-export GIT_WORK_TREE=..\n+GIT_DIR=\"../$TRASH_DIRECTORY/.git\" && export GIT_DIR\n+GIT_WORK_TREE=.. && export GIT_WORK_TREE\n \n test_vars 'rel gitdir, foo' \"$TRASH_DIRECTORY/.git\" \"/\" \"foo/\"\n test_foobar_foo\n \n test_expect_success 'go to /foo/bar' 'cd /foo/bar'\n \n-export GIT_DIR=\"../../$TRASH_DIRECTORY/.git\"\n-export GIT_WORK_TREE=../..\n+GIT_DIR=\"../../$TRASH_DIRECTORY/.git\" && export GIT_DIR\n+GIT_WORK_TREE=../.. && export GIT_WORK_TREE\n \n test_vars 'rel gitdir, foo/bar' \"$TRASH_DIRECTORY/.git\" \"/\" \"foo/bar/\"\n test_foobar_foobar\ndiff --git a/t/t5560-http-backend-noserver.sh b/t/t5560-http-backend-noserver.sh\nindex 44885b8..94f9d2e 100755\n--- a/t/t5560-http-backend-noserver.sh\n+++ b/t/t5560-http-backend-noserver.sh\n@@ -14,7 +14,7 @@ run_backend() {\n }\n \n GET() {\n-\texport REQUEST_METHOD=\"GET\" &&\n+\tREQUEST_METHOD=\"GET\" && export REQUEST_METHOD &&\n \trun_backend \"/repo.git/$1\" &&\n \tunset REQUEST_METHOD &&\n \tif ! grep \"Status\" act.out >act\n@@ -26,8 +26,8 @@ GET() {\n }\n \n POST() {\n-\texport REQUEST_METHOD=\"POST\" &&\n-\texport CONTENT_TYPE=\"application/x-$1-request\" &&\n+\tREQUEST_METHOD=\"POST\" && export REQUEST_METHOD &&\n+\tCONTENT_TYPE=\"application/x-$1-request\" && export CONTENT_TYPE &&\n \trun_backend \"/repo.git/$1\" \"$2\" &&\n \tunset REQUEST_METHOD &&\n \tunset CONTENT_TYPE &&\n@@ -46,7 +46,7 @@ log_div() {\n . \"$TEST_DIRECTORY\"/t556x_common\n \n expect_aliased() {\n-\texport REQUEST_METHOD=\"GET\" &&\n+\tREQUEST_METHOD=\"GET\" && export REQUEST_METHOD &&\n \tif test $1 = 0; then\n \t\trun_backend \"$2\"\n \telse\ndiff --git a/t/t556x_common b/t/t556x_common\nindex be024e5..51287d8 100755\n--- a/t/t556x_common\n+++ b/t/t556x_common\n@@ -50,7 +50,7 @@ get_static_files() {\n }\n \n SMART=smart\n-export GIT_HTTP_EXPORT_ALL=1\n+GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL\n test_expect_success 'direct refs/heads/master not found' '\n \tlog_div \"refs/heads/master\"\n \tGET refs/heads/master \"404 Not Found\"\n@@ -73,7 +73,7 @@ test_expect_success 'export if git-daemon-export-ok' '\n         get_static_files \"200 OK\"\n '\n SMART=smart\n-export GIT_HTTP_EXPORT_ALL=1\n+GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL\n test_expect_success 'static file if http.getanyfile true is ok' '\n \tlog_div \"getanyfile true\"\n \tconfig http.getanyfile true &&\n"}]}