Skip to content

Commit 3b7e22f

Browse files
authored
Run "git init" if .git doesn't exist (#1695)
1 parent 76ed853 commit 3b7e22f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ if [ -z "${HOME:-}" ]; then
3131
mkdir "$HOME"
3232
fi
3333

34+
# If .git doesn't exist at the repo root, create it. It's required for the build to work. The very
35+
# prominent source tar.gz and zip files created by GitHub don't include it, so it's worth having a
36+
# fallback here. See https://github.com/dotnet/source-build/issues/1646 for details.
37+
if [ ! -e "$scriptroot/.git" ]; then
38+
(
39+
cd "$scriptroot"
40+
git init
41+
)
42+
fi
43+
3444
if grep -q '\(/docker/\|/docker-\)' "/proc/1/cgroup"; then
3545
export DotNetRunningInDocker=1
3646
fi

0 commit comments

Comments
 (0)