Skip to content

Commit d14d899

Browse files
committed
dotnet-prepare: use treeless clones if possible
Signed-off-by: Ilya Leoshkevich <[email protected]>
1 parent c3be7d0 commit d14d899

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

dotnet-prepare

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#!/bin/bash
2-
set -e -u -x
2+
set -e -u -x -o pipefail
33

44
BASEDIR=$(pwd)
55
PACKAGESDIR=${BASEDIR}/local-packages
66

7+
filter=()
8+
if git -C "$(dirname "$0")" fetch --filter=tree:0 >/dev/null 2>&1; then
9+
filter=(--filter=tree:0)
10+
fi
11+
712
function update_nuget_config {
813
gawk -f - -i inplace NuGet.config <<EOF
914
/<\/packageSources>/ { if (Src) print " <add key=\"nuget\" value=\"https://api.nuget.org/v3/index.json\" />"; Src = 0 }
@@ -63,7 +68,7 @@ function backport {
6368

6469
function prepare_runtime {
6570
pushd runtime
66-
git fetch
71+
git fetch "${filter[@]}"
6772
# [custom_attrs] Use the image's ALC instead of the default one
6873
# https://github.com/dotnet/runtime/pull/70346
6974
backport "" 32670bdf9973
@@ -170,7 +175,7 @@ else
170175
projects=(runtime msbuild roslyn sdk aspnetcore)
171176
fi
172177

173-
git submodule update --init --recursive -- "${projects[@]}"
178+
git submodule update "${filter[@]}" --init --recursive -- "${projects[@]}"
174179

175180
for project in "${projects[@]}"; do
176181
eval "prepare_${project}"

0 commit comments

Comments
 (0)