From 4fd50b84a82c8a196792dd41ed2a4cd7d1e3b2f8 Mon Sep 17 00:00:00 2001 From: Chris Rummel Date: Mon, 23 Jan 2023 11:32:40 -0600 Subject: [PATCH 1/2] Allow file protocol during source-build clone. --- .../tools/SourceBuild/git-clone-to-dir.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/git-clone-to-dir.sh b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/git-clone-to-dir.sh index cfda29c412e..a91c5f1dcf6 100755 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/git-clone-to-dir.sh +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/git-clone-to-dir.sh @@ -124,12 +124,12 @@ fi # * '--no-local' allows a shallow clone from a git dir on the same filesystem. This means the # clone will not use hard links and takes up more space. However, since we're doing a shallow # clone anyway, the difference is probably not significant. (This has not been measured.) - git clone --depth=1 --no-local --no-checkout "$sourceDir" "$destDir" + git clone -c protocol.file.allow=always --depth=1 --no-local --no-checkout "$sourceDir" "$destDir" # Put the 'shallow' file back so operations on the outer Git repo continue to work normally. printf "%s" "$shallowContent" > "$shallowFile" else - git clone --no-checkout "$sourceDir" "$destDir" + git clone -c protocol.file.allow=always --no-checkout "$sourceDir" "$destDir" fi ( From b95d25c6f56b0763c1d3dc153bb77157a42395ee Mon Sep 17 00:00:00 2001 From: Chris Rummel Date: Mon, 23 Jan 2023 11:53:46 -0600 Subject: [PATCH 2/2] Address code review comment. --- .../tools/SourceBuild/git-clone-to-dir.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/git-clone-to-dir.sh b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/git-clone-to-dir.sh index a91c5f1dcf6..654dde286a2 100755 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/git-clone-to-dir.sh +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/git-clone-to-dir.sh @@ -124,6 +124,8 @@ fi # * '--no-local' allows a shallow clone from a git dir on the same filesystem. This means the # clone will not use hard links and takes up more space. However, since we're doing a shallow # clone anyway, the difference is probably not significant. (This has not been measured.) + # * '-c protocol.file.allow=alwyas allows cloning from the local filesystem even on newer versions + # of git which have disabled this for security reasons. git clone -c protocol.file.allow=always --depth=1 --no-local --no-checkout "$sourceDir" "$destDir" # Put the 'shallow' file back so operations on the outer Git repo continue to work normally.