shell portability: no "export VAR=VAL"

It is more portable to say "VAR=VAL && export VAR" instead.

Noticed by Ævar.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2010-10-13 11:36:36 -07:00
parent bc97994530
commit 69ae92bda1
6 changed files with 23 additions and 23 deletions

View File

@ -137,7 +137,7 @@ It does not apply to blobs recorded in its index."
export GITHEAD_$his_tree export GITHEAD_$his_tree
if test -n "$GIT_QUIET" if test -n "$GIT_QUIET"
then then
export GIT_MERGE_VERBOSITY=0 GIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY
fi fi
git-merge-recursive $orig_tree -- HEAD $his_tree || { git-merge-recursive $orig_tree -- HEAD $his_tree || {
git rerere $allow_rerere_autoupdate git rerere $allow_rerere_autoupdate

View File

@ -111,7 +111,7 @@ call_merge () {
export GITHEAD_$cmt GITHEAD_$hd export GITHEAD_$cmt GITHEAD_$hd
if test -n "$GIT_QUIET" if test -n "$GIT_QUIET"
then then
export GIT_MERGE_VERBOSITY=1 GIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY
fi fi
eval 'git-merge-$strategy' $strategy_opts '"$cmt^" -- "$hd" "$cmt"' eval 'git-merge-$strategy' $strategy_opts '"$cmt^" -- "$hd" "$cmt"'
rv=$? rv=$?

View File

@ -373,7 +373,7 @@ apply_stash () {
if test -n "$GIT_QUIET" if test -n "$GIT_QUIET"
then then
export GIT_MERGE_VERBOSITY=0 GIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY
fi fi
if git merge-recursive $b_tree -- $c_tree $w_tree if git merge-recursive $b_tree -- $c_tree $w_tree
then then

View File

@ -134,8 +134,8 @@ cat >ls.expected <<EOF
100644 $ONE_SHA1 0 me 100644 $ONE_SHA1 0 me
EOF EOF
export GIT_DIR="$TRASH_DIRECTORY/.git" GIT_DIR="$TRASH_DIRECTORY/.git" && export GIT_DIR
export GIT_WORK_TREE=/ GIT_WORK_TREE=/ && export GIT_WORK_TREE
test_vars 'abs gitdir, root' "$GIT_DIR" "/" "" test_vars 'abs gitdir, root' "$GIT_DIR" "/" ""
test_foobar_root test_foobar_root
@ -154,24 +154,24 @@ say "GIT_DIR relative, GIT_WORK_TREE set"
test_expect_success 'go to /' 'cd /' test_expect_success 'go to /' 'cd /'
export GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" && export GIT_DIR
export GIT_WORK_TREE=/ GIT_WORK_TREE=/ && export GIT_WORK_TREE
test_vars 'rel gitdir, root' "$GIT_DIR" "/" "" test_vars 'rel gitdir, root' "$GIT_DIR" "/" ""
test_foobar_root test_foobar_root
test_expect_success 'go to /foo' 'cd /foo' test_expect_success 'go to /foo' 'cd /foo'
export GIT_DIR="../$TRASH_DIRECTORY/.git" GIT_DIR="../$TRASH_DIRECTORY/.git" && export GIT_DIR
export GIT_WORK_TREE=/ GIT_WORK_TREE=/ && export GIT_WORK_TREE
test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/" test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/"
test_foobar_foo test_foobar_foo
test_expect_success 'go to /foo/bar' 'cd /foo/bar' test_expect_success 'go to /foo/bar' 'cd /foo/bar'
export GIT_DIR="../../$TRASH_DIRECTORY/.git" GIT_DIR="../../$TRASH_DIRECTORY/.git" && export GIT_DIR
export GIT_WORK_TREE=/ GIT_WORK_TREE=/ && export GIT_WORK_TREE
test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/" test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/"
test_foobar_foobar test_foobar_foobar
@ -180,24 +180,24 @@ say "GIT_DIR relative, GIT_WORK_TREE relative"
test_expect_success 'go to /' 'cd /' test_expect_success 'go to /' 'cd /'
export GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" && export GIT_DIR
export GIT_WORK_TREE=. GIT_WORK_TREE=. && export GIT_WORK_TREE
test_vars 'rel gitdir, root' "$GIT_DIR" "/" "" test_vars 'rel gitdir, root' "$GIT_DIR" "/" ""
test_foobar_root test_foobar_root
test_expect_success 'go to /' 'cd /foo' test_expect_success 'go to /' 'cd /foo'
export GIT_DIR="../$TRASH_DIRECTORY/.git" GIT_DIR="../$TRASH_DIRECTORY/.git" && export GIT_DIR
export GIT_WORK_TREE=.. GIT_WORK_TREE=.. && export GIT_WORK_TREE
test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/" test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/"
test_foobar_foo test_foobar_foo
test_expect_success 'go to /foo/bar' 'cd /foo/bar' test_expect_success 'go to /foo/bar' 'cd /foo/bar'
export GIT_DIR="../../$TRASH_DIRECTORY/.git" GIT_DIR="../../$TRASH_DIRECTORY/.git" && export GIT_DIR
export GIT_WORK_TREE=../.. GIT_WORK_TREE=../.. && export GIT_WORK_TREE
test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/" test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/"
test_foobar_foobar test_foobar_foobar

View File

@ -14,7 +14,7 @@ run_backend() {
} }
GET() { GET() {
export REQUEST_METHOD="GET" && REQUEST_METHOD="GET" && export REQUEST_METHOD &&
run_backend "/repo.git/$1" && run_backend "/repo.git/$1" &&
unset REQUEST_METHOD && unset REQUEST_METHOD &&
if ! grep "Status" act.out >act if ! grep "Status" act.out >act
@ -26,8 +26,8 @@ GET() {
} }
POST() { POST() {
export REQUEST_METHOD="POST" && REQUEST_METHOD="POST" && export REQUEST_METHOD &&
export CONTENT_TYPE="application/x-$1-request" && CONTENT_TYPE="application/x-$1-request" && export CONTENT_TYPE &&
run_backend "/repo.git/$1" "$2" && run_backend "/repo.git/$1" "$2" &&
unset REQUEST_METHOD && unset REQUEST_METHOD &&
unset CONTENT_TYPE && unset CONTENT_TYPE &&
@ -46,7 +46,7 @@ log_div() {
. "$TEST_DIRECTORY"/t556x_common . "$TEST_DIRECTORY"/t556x_common
expect_aliased() { expect_aliased() {
export REQUEST_METHOD="GET" && REQUEST_METHOD="GET" && export REQUEST_METHOD &&
if test $1 = 0; then if test $1 = 0; then
run_backend "$2" run_backend "$2"
else else

View File

@ -50,7 +50,7 @@ get_static_files() {
} }
SMART=smart SMART=smart
export GIT_HTTP_EXPORT_ALL=1 GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL
test_expect_success 'direct refs/heads/master not found' ' test_expect_success 'direct refs/heads/master not found' '
log_div "refs/heads/master" log_div "refs/heads/master"
GET refs/heads/master "404 Not Found" GET refs/heads/master "404 Not Found"
@ -73,7 +73,7 @@ test_expect_success 'export if git-daemon-export-ok' '
get_static_files "200 OK" get_static_files "200 OK"
' '
SMART=smart SMART=smart
export GIT_HTTP_EXPORT_ALL=1 GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL
test_expect_success 'static file if http.getanyfile true is ok' ' test_expect_success 'static file if http.getanyfile true is ok' '
log_div "getanyfile true" log_div "getanyfile true"
config http.getanyfile true && config http.getanyfile true &&