blob: 1e357b2f8f3b88c961468592e0b528e1e8cb44cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
#!/bin/sh
MASTER=master
if test -z "$GIT"
then
case "$(git version 2>/dev/null)" in
"git version"*)
GIT=git ;;
*)
echo >&2 "No git to bootstrap"
exit 1 ;;
esac
fi
inst_prefix=$(
IFS=:
for p in $PATH
do
probed=${p%/git-active/bin}
if test "$probed" != "$p"
then
echo "$probed"
exit
fi
done
echo $HOME
)
LANG=C
for cv in PYTHON_PATH=python TCL_PATH=tclsh TCLTKPATH=wish
do
cmd=${cv#*=}
var=${cv%=*}
eval $(
if test -f "/usr/bin/$cmd"
then
break
fi
for p in /usr/bin /usr/local/bin
do
if test -f "$p/$cmd"
then
echo "$var=$p/$cmd; export $var"
break
fi
found=$(find "$p/$cmd"* -type f 2>/dev/null | head -n 1)
if test -f "$found"
then
echo "$var=$found; export $var"
break
fi
done
)
done
tests= jobs= skip= oldtest= with_dash= testpen=
clean=:
case `uname` in
OpenBSD)
# O="-fgnu89-inline"
skip="t9402"
;;
NetBSD)
OLD_ICONV=YesPlease; export OLD_ICONV
skip="t5000 t9402"
;;
FreeBSD)
OLD_ICONV=YesPlease; export OLD_ICONV
skip="t5560"
;;
SunOS)
NEEDS_CRYPTO_WITH_SSL=YesPlease ; export NEEDS_CRYPTO_WITH_SSL
NO_PEDANTIC=CannotDo
;;
esac
determine_branch () {
expr "$($GIT symbolic-ref --no-recurse HEAD 2>/dev/null ||
$GIT symbolic-ref HEAD 2>/dev/null)" : 'refs/heads/\(.*\)' ||
echo detached
}
determine_version () {
v=`$GIT describe HEAD`
expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && {
echo >&2 "You are on 'snap' but $v is not an official version."
exit 1
}
echo "$v"
}
determine_long_version () {
$GIT describe HEAD 2>/dev/null || echo unknown-g00000000 |
sed -e 's/-/./g'
}
BUILTIN_CLEAN_FIX=8687f777
if ! git merge-base --is-ancestor $BUILTIN_CLEAN_FIX HEAD
then
NO_PEDANTIC=YesPlease
fi
DEVELOPER=
case "$NO_PEDANTIC" in
?*) ;;
'')
DEVELOPER=1
;;
'not-used-anymore')
# PEDANT="-Wtypedef-redefinition $PEDANT"
PEDANT="-Werror -Wold-style-definition $PEDANT"
PEDANT="-Wpointer-arith -Woverflow -Wunused $PEDANT"
PEDANT="-Wold-style-declaration -Wstrict-prototypes $PEDANT"
PEDANT="-Wstrict-prototypes $PEDANT"
;;
esac
while case $# in 0) break ;; esac
do
case "$1" in
--pedantic)
echo >&2 "(no need to say --pedantic)"
;;
-j*)
case "$NO_JOBS" in
?*) jobs= ;;
'') jobs=$1 ;;
esac
;;
-noprove | --noprove)
oldtest=t
;;
-loose | --loose)
DEVELOPER= PEDANT=
;;
--memtrash)
testpen=testpen.$$
;;
--memtrash=*)
testpen=testpen.${1#--memtrash=}
;;
--locale=*)
LANG=${1#*=}
;;
--test=*)
tests=$(
cd t &&
IFS="$IFS,"
for t in ${1#*=}
do
eval echo "t$t-*.sh"
done | tr '\012' ' '
)
;;
--long)
GIT_TEST_LONG=YesPlease
export GIT_TEST_LONG
;;
--dash)
with_dash=y
;;
--)
shift
break
;;
-*)
echo >&2 "Eh $1?"
exit 1
;;
*)
break
;;
esac
shift
done
if test -n "$testpen"
then
for TRASH in /dev/shm /tmp ""
do
if test -n "$TRASH" &&
mkdir -p "$TRASH/$testpen" 2>/dev/null &&
test -w "$TRASH/$testpen"
then
testpen=$(cd "$TRASH/$testpen" && /bin/pwd)
TRASH="--root=$testpen"
clean="$clean; rmdir '$testpen'"
break
fi
done
GIT_TEST_OPTS="$TRASH${GIT_TEST_OPTS+" $GIT_TEST_OPTS"}"
export GIT_TEST_OPTS
fi
test -f /bin/dash || with_dash=
if test -z "$tests" && test -n "$skip"
then
GIT_SKIP_TESTS="${GIT_SKIP_TESTS:-$skip}"
export GIT_SKIP_TESTS
fi
if test -z "$oldtest" &&
sh -c 'prove --version >/dev/null 2>&1' &&
sh -c 'prove --exec : >/dev/null 2>&1'
then
# --state=slow,save
DEFAULT_TEST_TARGET=prove
GIT_PROVE_OPTS="${GIT_PROVE_OPTS:+$GIT_PROVE_OPTS }--timer $jobs"
export DEFAULT_TEST_TARGET GIT_PROVE_OPTS
fi
LC_ALL=$LANG
export LANG LC_ALL
branch=$(determine_branch)
case "$branch" in
next | maint | $MASTER | seen | jch)
prefix="$inst_prefix/git-$branch"
;;
snap)
v=$(determine_version)
prefix="$inst_prefix/git-snap-$v"
;;
*)
prefix="$inst_prefix/git-test" ;;
esac
clean="$clean; rm -f version"
determine_long_version >version
set "prefix=$prefix" "$@"
if test -n "$with_dash" && test -f /bin/dash
then
set "SHELL_PATH=/bin/dash" "$@"
fi
if grep >/dev/null DC_SHA1 Makefile
then
SHA1IMPLEMENTATION=DC_SHA1=YesPlease
elif grep >/dev/null BLK_SHA1 Makefile
then
SHA1IMPLEMENTATION=BLK_SHA1=YesPlease
else
SHA1IMPLEMENTATION=
fi
if test -f sha256/nettle.h && test -f /usr/include/nettle/sha2.h
then
SHA1IMPLEMENTATION="$SHA1IMPLEMENTATION NETTLE_SHA256=YesPlease"
fi
set MAN_BASE_URL='"http://www.kernel.org/pub/software/scm/git/docs/"' \
MAN_BOLD_LITERAL=YesPlease \
$SHA1IMPLEMENTATION \
GNU_ROFF=YesPlease \
USE_LIBPCRE=YesPlease \
"$@"
# Platform hack
if test -z "${make:+set}" && {
test -x /usr/local/bin/gmake ||
test -x /usr/pkg/bin/gmake ||
test -x /usr/bin/gmake
}
then
make=gmake
fi
if test -f /bin/ginstall
then
set INSTALL=ginstall "$@"
fi
unset SSH_AGENT_PID SSH_CLIENT SSH_TTY SSH_AUTH_SOCK SSH_CONNECTION \
GPG_AGENT_INFO GNOME_KEYRING_CONTROL GNOME_KEYRING_PID \
XDG_SESSION_COOKIE XDG_SESSION_PATH XDG_SEAT_PATH XDG_DATA_DIRS \
PGPPATH AUTO_PROXY WINDOWID SESSION_MANAGER XDG_CONFIG_DIRS STY \
GDMSESSION KRB5CCNAME GNOME_DESKTOP_SESSION_ID \
DBUS_SESSION_BUS_ADDRESS LESSOPEN WINDOW DISPLAY GTK_IM_MODULE \
XDG_CURRENT_DESKTOP LESSCLOSE XAUTHORITY
# O=-fsanitize=address Meta/Make
${make-make} \
$jobs \
ETC_GITCONFIG=$prefix/etc/gitconfig \
${DEVELOPER:+"DEVELOPER=YesPlease"} \
SPATCH_FLAGS="--all-includes --recursive-includes --patch ." \
SPATCH_BATCH_SIZE=16 \
CFLAGS="-g -Wall -Wunused -Wdeclaration-after-statement -std=gnu99${O:+ $O}" \
${tests:+"T=$tests"} ${tests:+UNIT_TESTS=} \
"$@"
status=$?
eval "$clean"
exit $status
|