t0001,t1510,t3301: use sane_unset which always returns with status 0
On some shells (like /usr/xpg4/bin/sh on Solaris), unset will exit non-zero when passed the name of a variable that has not been set. Use sane_unset instead so that the return value of unset can be ignored while the && linkage of the test script can be preserved. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Casey committed
Jan 5, 2011 at 18:30 UTC
ed40ec551d4517323c6a46aa555b83cc7651ddbc
3 files changed
+37
-37
t/t0001-init.sh
+4
-4
@@ -35,7 +35,7 @@ test_expect_success 'plain' '
35
36
test_expect_success 'plain nested in bare' '
37
(
38
- unset GIT_DIR GIT_WORK_TREE &&
38
+ sane_unset GIT_DIR GIT_WORK_TREE &&
39
git init --bare bare-ancestor.git &&
40
cd bare-ancestor.git &&
41
mkdir plain-nested &&
@@ -47,7 +47,7 @@ test_expect_success 'plain nested in bare' '
47
48
test_expect_success 'plain through aliased command, outside any git repo' '
49
(
50
- unset GIT_DIR GIT_WORK_TREE GIT_CONFIG_NOGLOBAL &&
50
+ sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG_NOGLOBAL &&
51
HOME=$(pwd)/alias-config &&
52
export HOME &&
53
mkdir alias-config &&
@@ -65,7 +65,7 @@ test_expect_success 'plain through aliased command, outside any git repo' '
65
66
test_expect_failure 'plain nested through aliased command' '
67
(
68
- unset GIT_DIR GIT_WORK_TREE &&
68
+ sane_unset GIT_DIR GIT_WORK_TREE &&
69
git init plain-ancestor-aliased &&
70
cd plain-ancestor-aliased &&
71
echo "[alias] aliasedinit = init" >>.git/config &&
@@ -78,7 +78,7 @@ test_expect_failure 'plain nested through aliased command' '
78
79
test_expect_failure 'plain nested in bare through aliased command' '
80
(
81
- unset GIT_DIR GIT_WORK_TREE &&
81
+ sane_unset GIT_DIR GIT_WORK_TREE &&
82
git init --bare bare-ancestor-aliased.git &&
83
cd bare-ancestor-aliased.git &&
84
echo "[alias] aliasedinit = init" >>config &&
t/t1510-repo-setup.sh
+32
-32
@@ -80,7 +80,7 @@ test_repo() {
80
# - cwd can't be outside worktree
81
82
test_expect_success '#0: setup' '
83
- unset GIT_DIR GIT_WORK_TREE &&
83
+ sane_unset GIT_DIR GIT_WORK_TREE &&
84
mkdir 0 0/sub &&
85
cd 0 && git init && cd ..
86
'
@@ -123,7 +123,7 @@ EOF
123
# GIT_WORK_TREE is ignored -> #0
124
125
test_expect_success '#1: setup' '
126
- unset GIT_DIR GIT_WORK_TREE &&
126
+ sane_unset GIT_DIR GIT_WORK_TREE &&
127
mkdir 1 1/sub 1.wt 1.wt/sub 1/wt 1/wt/sub &&
128
cd 1 &&
129
git init &&
@@ -174,7 +174,7 @@ EOF
174
# - cwd can't be outside worktree
175
176
test_expect_success '#2: setup' '
177
- unset GIT_DIR GIT_WORK_TREE &&
177
+ sane_unset GIT_DIR GIT_WORK_TREE &&
178
mkdir 2 2/sub &&
179
cd 2 && git init && cd ..
180
'
@@ -241,7 +241,7 @@ EOF
241
# - cwd can be outside worktree
242
243
test_expect_success '#3: setup' '
244
- unset GIT_DIR GIT_WORK_TREE &&
244
+ sane_unset GIT_DIR GIT_WORK_TREE &&
245
mkdir 3 3/sub 3/sub/sub 3.wt 3.wt/sub 3/wt 3/wt/sub &&
246
cd 3 && git init && cd ..
247
'
@@ -504,7 +504,7 @@ EOF
504
# core.worktree is ignored -> #0
505
506
test_expect_success '#4: setup' '
507
- unset GIT_DIR GIT_WORK_TREE &&
507
+ sane_unset GIT_DIR GIT_WORK_TREE &&
508
mkdir 4 4/sub &&
509
cd 4 &&
510
git init &&
@@ -550,7 +550,7 @@ EOF
550
# GIT_WORK_TREE/core.worktree are ignored -> #0
551
552
test_expect_success '#5: setup' '
553
- unset GIT_DIR GIT_WORK_TREE &&
553
+ sane_unset GIT_DIR GIT_WORK_TREE &&
554
mkdir 5 5/sub &&
555
cd 5 &&
556
git init &&
@@ -602,7 +602,7 @@ EOF
602
# - cwd can be outside worktree
603
604
test_expect_success '#6: setup' '
605
- unset GIT_DIR GIT_WORK_TREE &&
605
+ sane_unset GIT_DIR GIT_WORK_TREE &&
606
mkdir 6 6/sub 6/sub/sub 6.wt 6.wt/sub 6/wt 6/wt/sub &&
607
cd 6 && git init && cd ..
608
'
@@ -889,7 +889,7 @@ EOF
889
# core.worktree is overridden by GIT_WORK_TREE -> #3
890
891
test_expect_success '#7: setup' '
892
- unset GIT_DIR GIT_WORK_TREE &&
892
+ sane_unset GIT_DIR GIT_WORK_TREE &&
893
mkdir 7 7/sub 7/sub/sub 7.wt 7.wt/sub 7/wt 7/wt/sub &&
894
cd 7 &&
895
git init &&
@@ -1155,7 +1155,7 @@ EOF
1155
# #0 except that git_dir is set by .git file
1156
1157
test_expect_success '#8: setup' '
1158
- unset GIT_DIR GIT_WORK_TREE &&
1158
+ sane_unset GIT_DIR GIT_WORK_TREE &&
1159
mkdir 8 8/sub &&
1160
cd 8 &&
1161
git init &&
@@ -1202,7 +1202,7 @@ EOF
1202
# #1 except that git_dir is set by .git file
1203
1204
test_expect_success '#9: setup' '
1205
- unset GIT_DIR GIT_WORK_TREE &&
1205
+ sane_unset GIT_DIR GIT_WORK_TREE &&
1206
mkdir 9 9/sub 9.wt 9.wt/sub 9/wt 9/wt/sub &&
1207
cd 9 &&
1208
git init &&
@@ -1251,7 +1251,7 @@ EOF
1251
# #2 except that git_dir is set by .git file
1252
1253
test_expect_success '#10: setup' '
1254
- unset GIT_DIR GIT_WORK_TREE &&
1254
+ sane_unset GIT_DIR GIT_WORK_TREE &&
1255
mkdir 10 10/sub &&
1256
cd 10 &&
1257
git init &&
@@ -1318,7 +1318,7 @@ EOF
1318
# #3 except that git_dir is set by .git file
1319
1320
test_expect_success '#11: setup' '
1321
- unset GIT_DIR GIT_WORK_TREE &&
1321
+ sane_unset GIT_DIR GIT_WORK_TREE &&
1322
mkdir 11 11/sub 11/sub/sub 11.wt 11.wt/sub 11/wt 11/wt/sub &&
1323
cd 11 &&
1324
git init &&
@@ -1586,7 +1586,7 @@ EOF
1586
1587
1588
test_expect_success '#12: setup' '
1589
- unset GIT_DIR GIT_WORK_TREE &&
1589
+ sane_unset GIT_DIR GIT_WORK_TREE &&
1590
mkdir 12 12/sub 12/sub/sub 12.wt 12.wt/sub 12/wt 12/wt/sub &&
1591
cd 12 &&
1592
git init &&
@@ -1634,7 +1634,7 @@ EOF
1634
# #5 except that git_dir is set by .git file
1635
1636
test_expect_success '#13: setup' '
1637
- unset GIT_DIR GIT_WORK_TREE &&
1637
+ sane_unset GIT_DIR GIT_WORK_TREE &&
1638
mkdir 13 13/sub 13/sub/sub 13.wt 13.wt/sub 13/wt 13/wt/sub &&
1639
cd 13 &&
1640
git init &&
@@ -1684,7 +1684,7 @@ EOF
1684
# #6 except that git_dir is set by .git file
1685
1686
test_expect_success '#14: setup' '
1687
- unset GIT_DIR GIT_WORK_TREE &&
1687
+ sane_unset GIT_DIR GIT_WORK_TREE &&
1688
mkdir 14 14/sub 14/sub/sub 14.wt 14.wt/sub 14/wt 14/wt/sub &&
1689
cd 14 &&
1690
git init &&
@@ -1975,7 +1975,7 @@ EOF
1975
# #7 except that git_dir is set by .git file
1976
1977
test_expect_success '#15: setup' '
1978
- unset GIT_DIR GIT_WORK_TREE &&
1978
+ sane_unset GIT_DIR GIT_WORK_TREE &&
1979
mkdir 15 15/sub 15/sub/sub 15.wt 15.wt/sub 15/wt 15/wt/sub &&
1980
cd 15 &&
1981
git init &&
@@ -2247,7 +2247,7 @@ EOF
2247
# - cwd can't be outside worktree
2248
2249
test_expect_success '#16.1: setup' '
2250
- unset GIT_DIR GIT_WORK_TREE &&
2250
+ sane_unset GIT_DIR GIT_WORK_TREE &&
2251
mkdir 16 16/sub &&
2252
cd 16 &&
2253
git init &&
@@ -2378,7 +2378,7 @@ EOF
2378
# GIT_WORK_TREE is ignored -> #16.1 (with warnings perhaps)
2379
2380
test_expect_success '#17.1: setup' '
2381
- unset GIT_DIR GIT_WORK_TREE &&
2381
+ sane_unset GIT_DIR GIT_WORK_TREE &&
2382
mkdir 17 17/sub &&
2383
cd 17 &&
2384
git init &&
@@ -2511,7 +2511,7 @@ EOF
2511
# - cwd can't be outside worktree
2512
2513
test_expect_success '#18: setup' '
2514
- unset GIT_DIR GIT_WORK_TREE &&
2514
+ sane_unset GIT_DIR GIT_WORK_TREE &&
2515
mkdir 18 18/sub &&
2516
cd 18 &&
2517
git init &&
@@ -2578,7 +2578,7 @@ EOF
2578
# bare repo is overridden by GIT_WORK_TREE -> #3
2579
2580
test_expect_success '#19: setup' '
2581
- unset GIT_DIR GIT_WORK_TREE &&
2581
+ sane_unset GIT_DIR GIT_WORK_TREE &&
2582
mkdir 19 19/sub 19/sub/sub 19.wt 19.wt/sub 19/wt 19/wt/sub &&
2583
cd 19 &&
2584
git init &&
@@ -2844,7 +2844,7 @@ EOF
2844
# core.worktree is ignored -> #16.1
2845
2846
test_expect_success '#20.1: setup' '
2847
- unset GIT_DIR GIT_WORK_TREE &&
2847
+ sane_unset GIT_DIR GIT_WORK_TREE &&
2848
mkdir 20 20/sub &&
2849
cd 20 &&
2850
git init &&
@@ -2972,7 +2972,7 @@ EOF
2972
# GIT_WORK_TREE/core.worktree are ignored -> #20.1
2973
2974
test_expect_success '#21.1: setup' '
2975
- unset GIT_DIR GIT_WORK_TREE &&
2975
+ sane_unset GIT_DIR GIT_WORK_TREE &&
2976
mkdir 21 21/sub &&
2977
cd 21 &&
2978
git init &&
@@ -3108,7 +3108,7 @@ EOF
3108
# - cwd can be outside worktree
3109
3110
test_expect_success '#22.1: setup' '
3111
- unset GIT_DIR GIT_WORK_TREE &&
3111
+ sane_unset GIT_DIR GIT_WORK_TREE &&
3112
mkdir 22 &&
3113
cd 22 &&
3114
git init &&
@@ -3439,7 +3439,7 @@ test_expect_success '#22.2: at root' '
3439
# core.worktree is overridden by GIT_WORK_TREE -> #19
3440
3441
test_expect_success '#23: setup' '
3442
- unset GIT_DIR GIT_WORK_TREE &&
3442
+ sane_unset GIT_DIR GIT_WORK_TREE &&
3443
mkdir 23 23/sub 23/sub/sub 23.wt 23.wt/sub 23/wt 23/wt/sub &&
3444
cd 23 &&
3445
git init &&
@@ -3706,7 +3706,7 @@ EOF
3706
# #16.2 except git_dir is set according to .git file
3707
3708
test_expect_success '#24: setup' '
3709
- unset GIT_DIR GIT_WORK_TREE &&
3709
+ sane_unset GIT_DIR GIT_WORK_TREE &&
3710
mkdir 24 24/sub &&
3711
cd 24 &&
3712
git init &&
@@ -3754,7 +3754,7 @@ EOF
3754
# #17.2 except git_dir is set according to .git file
3755
3756
test_expect_success '#25: setup' '
3757
- unset GIT_DIR GIT_WORK_TREE &&
3757
+ sane_unset GIT_DIR GIT_WORK_TREE &&
3758
mkdir 25 25/sub &&
3759
cd 25 &&
3760
git init &&
@@ -3804,7 +3804,7 @@ EOF
3804
# #18 except git_dir is set according to .git file
3805
3806
test_expect_success '#26: setup' '
3807
- unset GIT_DIR GIT_WORK_TREE &&
3807
+ sane_unset GIT_DIR GIT_WORK_TREE &&
3808
mkdir 26 26/sub &&
3809
cd 26 &&
3810
git init &&
@@ -3872,7 +3872,7 @@ EOF
3872
# #19 except git_dir is set according to .git file
3873
3874
test_expect_success '#27: setup' '
3875
- unset GIT_DIR GIT_WORK_TREE &&
3875
+ sane_unset GIT_DIR GIT_WORK_TREE &&
3876
mkdir 27 27/sub 27/sub/sub 27.wt 27.wt/sub 27/wt 27/wt/sub &&
3877
cd 27 &&
3878
git init &&
@@ -4140,7 +4140,7 @@ EOF
4140
# core.worktree is ignored -> #24
4141
4142
test_expect_success '#28: setup' '
4143
- unset GIT_DIR GIT_WORK_TREE &&
4143
+ sane_unset GIT_DIR GIT_WORK_TREE &&
4144
mkdir 28 28/sub &&
4145
cd 28 &&
4146
git init &&
@@ -4189,7 +4189,7 @@ EOF
4189
# GIT_WORK_TREE/core.worktree are ignored -> #28
4190
4191
test_expect_success '#29: setup' '
4192
- unset GIT_DIR GIT_WORK_TREE &&
4192
+ sane_unset GIT_DIR GIT_WORK_TREE &&
4193
mkdir 29 29/sub &&
4194
cd 29 &&
4195
git init &&
@@ -4239,7 +4239,7 @@ EOF
4239
# core.worktree and core.bare conflict, won't fly.
4240
4241
test_expect_success '#30: setup' '
4242
- unset GIT_DIR GIT_WORK_TREE &&
4242
+ sane_unset GIT_DIR GIT_WORK_TREE &&
4243
mkdir 30 &&
4244
cd 30 &&
4245
git init &&
@@ -4278,7 +4278,7 @@ test_expect_success '#30: at root' '
4278
# #23 except git_dir is set according to .git file
4279
4280
test_expect_success '#31: setup' '
4281
- unset GIT_DIR GIT_WORK_TREE &&
4281
+ sane_unset GIT_DIR GIT_WORK_TREE &&
4282
mkdir 31 31/sub 31/sub/sub 31.wt 31.wt/sub 31/wt 31/wt/sub &&
4283
cd 31 &&
4284
git init &&
t/t3301-notes.sh
+1
-1
@@ -1067,7 +1067,7 @@ test_expect_success 'git notes copy diagnoses too many or too few parameters' '
1067
1068
test_expect_success 'git notes get-ref (no overrides)' '
1069
git config --unset core.notesRef &&
1070
- unset GIT_NOTES_REF &&
1070
+ sane_unset GIT_NOTES_REF &&
1071
test "$(git notes get-ref)" = "refs/notes/commits"
1072
'
1073