git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t/t5560: use `X=Y && export X' not `export X=Y'

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 7, 2010, 07:47 UTC
Message-ID
<1286437634-12593-1-git-send-email-avarab@gmail.com>

Change t/t5560-http-backend-noserver.sh to use the `X=Y && export X' style instead of `export X=Y'. The latter doesn't work on all POSIX shells.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t5560-http-backend-noserver.sh |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/t/t5560-http-backend-noserver.sh b/t/t5560-http-backend-noserver.sh
index 406432e..effe797 100755
--- a/t/t5560-http-backend-noserver.sh
+++ b/t/t5560-http-backend-noserver.sh
@@ -5,7 +5,11 @@ test_description='test git-http-backend-noserver'
 
 HTTPD_DOCUMENT_ROOT_PATH="$TRASH_DIRECTORY"
 
-test_have_prereq MINGW && export GREP_OPTIONS=-U
+if test_have_prereq MINGW
+then
+	GREP_OPTIONS=-U
+	export GREP_OPTIONS
+fi
 
 run_backend() {
 	echo "$2" |
@@ -15,7 +19,8 @@ run_backend() {
 }
 
 GET() {
-	export REQUEST_METHOD="GET" &&
+	REQUEST_METHOD="GET" &&
+	export REQUEST_METHOD &&
 	run_backend "/repo.git/$1" &&
 	unset REQUEST_METHOD &&
 	if ! grep "Status" act.out >act
@@ -27,8 +32,9 @@ GET() {
 }
 
 POST() {
-	export REQUEST_METHOD="POST" &&
-	export CONTENT_TYPE="application/x-$1-request" &&
+	REQUEST_METHOD="POST" &&
+	CONTENT_TYPE="application/x-$1-request" &&
+	export REQUEST_METHOD CONTENT_TYPE &&
 	run_backend "/repo.git/$1" "$2" &&
 	unset REQUEST_METHOD &&
 	unset CONTENT_TYPE &&
@@ -47,7 +53,8 @@ log_div() {
 . "$TEST_DIRECTORY"/t556x_common
 
 expect_aliased() {
-	export REQUEST_METHOD="GET" &&
+	REQUEST_METHOD="GET" &&
+	export REQUEST_METHOD &&
 	if test $1 = 0; then
 		run_backend "$2"
 	else
-- 
1.7.3.1.50.g1e633
Next: Matthieu Moy
Message 1 of 5 in “t/t5560: use `X=Y && export X' not `export X=Y'”
  1. t/t5560: use `X=Y && export X' not `export X=Y'Ævar Arnfjörð Bjarmason, Oct 7, 2010
  2. Matthieu MoyOct 7, 2010
  3. Ævar Arnfjörð BjarmasonOct 7, 2010
  4. Clemens BuchacherOct 10, 2010
  5. Junio C HamanoOct 13, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.