Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
shell portability: no "export VAR=VAL"
author
Junio C Hamano
<gitster@pobox.com>
Wed, 13 Oct 2010 18:36:36 +0000
(11:36 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 13 Oct 2010 18:36:36 +0000
(11:36 -0700)
It is more portable to say "VAR=VAL && export VAR" instead.
Noticed by Ævar.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-am.sh
patch
|
blob
|
history
git-rebase.sh
patch
|
blob
|
history
git-stash.sh
patch
|
blob
|
history
t/t1509-root-worktree.sh
patch
|
blob
|
history
t/t5560-http-backend-noserver.sh
patch
|
blob
|
history
t/t556x_common
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
bc97994
)
diff --git
a/git-am.sh
b/git-am.sh
index e7f008c7baae2ff484e16882e199b6b9d75195aa..5f249485df230bed0d2a620104369260b0ac8b66 100755
(executable)
--- a/
git-am.sh
+++ b/
git-am.sh
@@
-137,7
+137,7
@@
It does not apply to blobs recorded in its index."
export GITHEAD_$his_tree
if test -n "$GIT_QUIET"
then
export GITHEAD_$his_tree
if test -n "$GIT_QUIET"
then
- export GIT_MERGE_VERBOSITY=0
+ GIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY
fi
git-merge-recursive $orig_tree -- HEAD $his_tree || {
git rerere $allow_rerere_autoupdate
fi
git-merge-recursive $orig_tree -- HEAD $his_tree || {
git rerere $allow_rerere_autoupdate
diff --git
a/git-rebase.sh
b/git-rebase.sh
index 3335cee70b8ea5510f109da83d8470d3bbabab52..e5df23bb8350d6d155bdf1ac9a5be4c9fdc29326 100755
(executable)
--- a/
git-rebase.sh
+++ b/
git-rebase.sh
@@
-111,7
+111,7
@@
call_merge () {
export GITHEAD_$cmt GITHEAD_$hd
if test -n "$GIT_QUIET"
then
export GITHEAD_$cmt GITHEAD_$hd
if test -n "$GIT_QUIET"
then
- export GIT_MERGE_VERBOSITY=1
+ GIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY
fi
eval 'git-merge-$strategy' $strategy_opts '"$cmt^" -- "$hd" "$cmt"'
rv=$?
fi
eval 'git-merge-$strategy' $strategy_opts '"$cmt^" -- "$hd" "$cmt"'
rv=$?
diff --git
a/git-stash.sh
b/git-stash.sh
index 5fb1245ea74a3029790c4c7886f9c6a32bddaa13..7561b374d2ec90fe774e98e39a121a1a3a3cdfa9 100755
(executable)
--- a/
git-stash.sh
+++ b/
git-stash.sh
@@
-373,7
+373,7
@@
apply_stash () {
if test -n "$GIT_QUIET"
then
if test -n "$GIT_QUIET"
then
- export GIT_MERGE_VERBOSITY=0
+ GIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY
fi
if git merge-recursive $b_tree -- $c_tree $w_tree
then
fi
if git merge-recursive $b_tree -- $c_tree $w_tree
then
diff --git
a/t/t1509-root-worktree.sh
b/t/t1509-root-worktree.sh
index 7f60fd0b2e8904ec231975df3d65e66c9363ff45..335420fd87f87727f323156f461e520374b7da0b 100755
(executable)
--- a/
t/t1509-root-worktree.sh
+++ b/
t/t1509-root-worktree.sh
@@
-134,8
+134,8
@@
cat >ls.expected <<EOF
100644 $ONE_SHA1 0 me
EOF
100644 $ONE_SHA1 0 me
EOF
-export GIT_DIR="$TRASH_DIRECTORY/.git"
-export GIT_WORK_TREE=/
+GIT_DIR="$TRASH_DIRECTORY/.git" && export GIT_DIR
+GIT_WORK_TREE=/ && export GIT_WORK_TREE
test_vars 'abs gitdir, root' "$GIT_DIR" "/" ""
test_foobar_root
test_vars 'abs gitdir, root' "$GIT_DIR" "/" ""
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"
-export GIT_WORK_TREE=/
+GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" && export GIT_DIR
+GIT_WORK_TREE=/ && export GIT_WORK_TREE
test_vars 'rel gitdir, root' "$GIT_DIR" "/" ""
test_foobar_root
test_expect_success 'go to /foo' 'cd /foo'
test_vars 'rel gitdir, root' "$GIT_DIR" "/" ""
test_foobar_root
test_expect_success 'go to /foo' 'cd /foo'
-export GIT_DIR="../$TRASH_DIRECTORY/.git"
-export GIT_WORK_TREE=/
+GIT_DIR="../$TRASH_DIRECTORY/.git" && export GIT_DIR
+GIT_WORK_TREE=/ && export GIT_WORK_TREE
test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/"
test_foobar_foo
test_expect_success 'go to /foo/bar' 'cd /foo/bar'
test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/"
test_foobar_foo
test_expect_success 'go to /foo/bar' 'cd /foo/bar'
-export GIT_DIR="../../$TRASH_DIRECTORY/.git"
-export GIT_WORK_TREE=/
+GIT_DIR="../../$TRASH_DIRECTORY/.git" && export GIT_DIR
+GIT_WORK_TREE=/ && export GIT_WORK_TREE
test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/"
test_foobar_foobar
test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/"
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"
-export GIT_WORK_TREE=.
+GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" && export GIT_DIR
+GIT_WORK_TREE=. && export GIT_WORK_TREE
test_vars 'rel gitdir, root' "$GIT_DIR" "/" ""
test_foobar_root
test_expect_success 'go to /' 'cd /foo'
test_vars 'rel gitdir, root' "$GIT_DIR" "/" ""
test_foobar_root
test_expect_success 'go to /' 'cd /foo'
-export GIT_DIR="../$TRASH_DIRECTORY/.git"
-export GIT_WORK_TREE=..
+GIT_DIR="../$TRASH_DIRECTORY/.git" && export GIT_DIR
+GIT_WORK_TREE=.. && export GIT_WORK_TREE
test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/"
test_foobar_foo
test_expect_success 'go to /foo/bar' 'cd /foo/bar'
test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/"
test_foobar_foo
test_expect_success 'go to /foo/bar' 'cd /foo/bar'
-export GIT_DIR="../../$TRASH_DIRECTORY/.git"
-export GIT_WORK_TREE=../..
+GIT_DIR="../../$TRASH_DIRECTORY/.git" && export GIT_DIR
+GIT_WORK_TREE=../.. && export GIT_WORK_TREE
test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/"
test_foobar_foobar
test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/"
test_foobar_foobar
diff --git
a/t/t5560-http-backend-noserver.sh
b/t/t5560-http-backend-noserver.sh
index 44885b850c4a1c3a09b8b078a643cf7cd8918213..94f9d2e8e0790c22b9884cee4b668b8a6d408d99 100755
(executable)
--- a/
t/t5560-http-backend-noserver.sh
+++ b/
t/t5560-http-backend-noserver.sh
@@
-14,7
+14,7
@@
run_backend() {
}
GET() {
}
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
run_backend "/repo.git/$1" &&
unset REQUEST_METHOD &&
if ! grep "Status" act.out >act
@@
-26,8
+26,8
@@
GET() {
}
POST() {
}
POST() {
-
export REQUEST_METHOD="POST"
&&
-
export CONTENT_TYPE="application/x-$1-request"
&&
+
REQUEST_METHOD="POST" && export REQUEST_METHOD
&&
+
CONTENT_TYPE="application/x-$1-request" && export CONTENT_TYPE
&&
run_backend "/repo.git/$1" "$2" &&
unset REQUEST_METHOD &&
unset CONTENT_TYPE &&
run_backend "/repo.git/$1" "$2" &&
unset REQUEST_METHOD &&
unset CONTENT_TYPE &&
@@
-46,7
+46,7
@@
log_div() {
. "$TEST_DIRECTORY"/t556x_common
expect_aliased() {
. "$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
if test $1 = 0; then
run_backend "$2"
else
diff --git
a/t/t556x_common
b/t/t556x_common
index be024e551c977355d8611c2134a4eda97a2bcc7d..51287d89d8deb27ae2ae49fec84268422377eb29 100755
(executable)
--- a/
t/t556x_common
+++ b/
t/t556x_common
@@
-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' '
log_div "refs/heads/master"
GET refs/heads/master "404 Not Found"
test_expect_success 'direct refs/heads/master not found' '
log_div "refs/heads/master"
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"
'
SMART=smart
get_static_files "200 OK"
'
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' '
log_div "getanyfile true"
config http.getanyfile true &&
test_expect_success 'static file if http.getanyfile true is ok' '
log_div "getanyfile true"
config http.getanyfile true &&