Skip to content

Commit abae168

Browse files
committed
if source is git, make /checkout dir safe for git
Signed-off-by: onur-ozkan <[email protected]>
1 parent 3e4a15e commit abae168

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/ci/docker/run.sh

+12-3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ root_dir="`dirname $src_dir`"
3636
objdir=$root_dir/obj
3737
dist=$objdir/build/dist
3838

39+
40+
if [ -d "$root_dir/.git" ]; then
41+
IS_GIT_SOURCE=1
42+
fi
43+
3944
source "$ci_dir/shared.sh"
4045

4146
CACHE_DOMAIN="${CACHE_DOMAIN:-ci-caches.rust-lang.org}"
@@ -249,9 +254,13 @@ if [ "$dev" = "1" ]
249254
then
250255
# Interactive + TTY
251256
args="$args -it"
252-
command="/bin/bash"
257+
if [ $IS_GIT_SOURCE -eq 1 ]; then
258+
command=(/bin/bash -c 'git config --global --add safe.directory /checkout;bash')
259+
else
260+
command=(/bin/bash)
261+
fi
253262
else
254-
command="/checkout/src/ci/run.sh"
263+
command=(/checkout/src/ci/run.sh)
255264
fi
256265

257266
if [ "$CI" != "" ]; then
@@ -301,7 +310,7 @@ docker \
301310
--init \
302311
--rm \
303312
rust-ci \
304-
$command
313+
"${command[@]}"
305314

306315
cat $objdir/${SUMMARY_FILE} >> "${GITHUB_STEP_SUMMARY}"
307316

0 commit comments

Comments
 (0)