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>
Junio C Hamano committed
Oct 13, 2010 at 11:36 UTC
69ae92bda13dfbf0b7d169c57b9f2715af2a9d67
6 files changed
+23
-23
git-am.sh
+1
-1
@@ -137,7 +137,7 @@ It does not apply to blobs recorded in its index."
137
export GITHEAD_$his_tree
138
if test -n "$GIT_QUIET"
139
then
140
- export GIT_MERGE_VERBOSITY=0
140
+ GIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY
141
fi
142
git-merge-recursive $orig_tree -- HEAD $his_tree || {
143
git rerere $allow_rerere_autoupdate
git-rebase.sh
+1
-1
@@ -111,7 +111,7 @@ call_merge () {
111
export GITHEAD_$cmt GITHEAD_$hd
112
if test -n "$GIT_QUIET"
113
then
114
- export GIT_MERGE_VERBOSITY=1
114
+ GIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY
115
fi
116
eval 'git-merge-$strategy' $strategy_opts '"$cmt^" -- "$hd" "$cmt"'
117
rv=$?
git-stash.sh
+1
-1
@@ -373,7 +373,7 @@ apply_stash () {
373
374
if test -n "$GIT_QUIET"
375
then
376
- export GIT_MERGE_VERBOSITY=0
376
+ GIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY
377
fi
378
if git merge-recursive $b_tree -- $c_tree $w_tree
379
then
t/t1509-root-worktree.sh
+14
-14
@@ -134,8 +134,8 @@ cat >ls.expected <<EOF
134
100644 $ONE_SHA1 0 me
135
EOF
136
137
-export GIT_DIR="$TRASH_DIRECTORY/.git"
138
-export GIT_WORK_TREE=/
137
+GIT_DIR="$TRASH_DIRECTORY/.git" && export GIT_DIR
138
+GIT_WORK_TREE=/ && export GIT_WORK_TREE
139
140
test_vars 'abs gitdir, root' "$GIT_DIR" "/" ""
141
test_foobar_root
@@ -154,24 +154,24 @@ say "GIT_DIR relative, GIT_WORK_TREE set"
154
155
test_expect_success 'go to /' 'cd /'
156
157
-export GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git"
158
-export GIT_WORK_TREE=/
157
+GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" && export GIT_DIR
158
+GIT_WORK_TREE=/ && export GIT_WORK_TREE
159
160
test_vars 'rel gitdir, root' "$GIT_DIR" "/" ""
161
test_foobar_root
162
163
test_expect_success 'go to /foo' 'cd /foo'
164
165
-export GIT_DIR="../$TRASH_DIRECTORY/.git"
166
-export GIT_WORK_TREE=/
165
+GIT_DIR="../$TRASH_DIRECTORY/.git" && export GIT_DIR
166
+GIT_WORK_TREE=/ && export GIT_WORK_TREE
167
168
test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/"
169
test_foobar_foo
170
171
test_expect_success 'go to /foo/bar' 'cd /foo/bar'
172
173
-export GIT_DIR="../../$TRASH_DIRECTORY/.git"
174
-export GIT_WORK_TREE=/
173
+GIT_DIR="../../$TRASH_DIRECTORY/.git" && export GIT_DIR
174
+GIT_WORK_TREE=/ && export GIT_WORK_TREE
175
176
test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/"
177
test_foobar_foobar
@@ -180,24 +180,24 @@ say "GIT_DIR relative, GIT_WORK_TREE relative"
180
181
test_expect_success 'go to /' 'cd /'
182
183
-export GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git"
184
-export GIT_WORK_TREE=.
183
+GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" && export GIT_DIR
184
+GIT_WORK_TREE=. && export GIT_WORK_TREE
185
186
test_vars 'rel gitdir, root' "$GIT_DIR" "/" ""
187
test_foobar_root
188
189
test_expect_success 'go to /' 'cd /foo'
190
191
-export GIT_DIR="../$TRASH_DIRECTORY/.git"
192
-export GIT_WORK_TREE=..
191
+GIT_DIR="../$TRASH_DIRECTORY/.git" && export GIT_DIR
192
+GIT_WORK_TREE=.. && export GIT_WORK_TREE
193
194
test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/"
195
test_foobar_foo
196
197
test_expect_success 'go to /foo/bar' 'cd /foo/bar'
198
199
-export GIT_DIR="../../$TRASH_DIRECTORY/.git"
200
-export GIT_WORK_TREE=../..
199
+GIT_DIR="../../$TRASH_DIRECTORY/.git" && export GIT_DIR
200
+GIT_WORK_TREE=../.. && export GIT_WORK_TREE
201
202
test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/"
203
test_foobar_foobar
t/t5560-http-backend-noserver.sh
+4
-4
@@ -14,7 +14,7 @@ run_backend() {
14
}
15
16
GET() {
17
- export REQUEST_METHOD="GET" &&
17
+ REQUEST_METHOD="GET" && export REQUEST_METHOD &&
18
run_backend "/repo.git/$1" &&
19
unset REQUEST_METHOD &&
20
if ! grep "Status" act.out >act
@@ -26,8 +26,8 @@ GET() {
26
}
27
28
POST() {
29
- export REQUEST_METHOD="POST" &&
30
- export CONTENT_TYPE="application/x-$1-request" &&
29
+ REQUEST_METHOD="POST" && export REQUEST_METHOD &&
30
+ CONTENT_TYPE="application/x-$1-request" && export CONTENT_TYPE &&
31
run_backend "/repo.git/$1" "$2" &&
32
unset REQUEST_METHOD &&
33
unset CONTENT_TYPE &&
@@ -46,7 +46,7 @@ log_div() {
46
. "$TEST_DIRECTORY"/t556x_common
47
48
expect_aliased() {
49
- export REQUEST_METHOD="GET" &&
49
+ REQUEST_METHOD="GET" && export REQUEST_METHOD &&
50
if test $1 = 0; then
51
run_backend "$2"
52
else
t/t556x_common
+2
-2
@@ -50,7 +50,7 @@ get_static_files() {
50
}
51
52
SMART=smart
53
-export GIT_HTTP_EXPORT_ALL=1
53
+GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL
54
test_expect_success 'direct refs/heads/master not found' '
55
log_div "refs/heads/master"
56
GET refs/heads/master "404 Not Found"
@@ -73,7 +73,7 @@ test_expect_success 'export if git-daemon-export-ok' '
73
get_static_files "200 OK"
74
'
75
SMART=smart
76
-export GIT_HTTP_EXPORT_ALL=1
76
+GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL
77
test_expect_success 'static file if http.getanyfile true is ok' '
78
log_div "getanyfile true"
79
config http.getanyfile true &&