Refactor tarball creation to avoid retrieving all git history (#11029)

This commit is contained in:
Michael Simons 2021-07-07 09:24:46 -05:00 committed by GitHub
parent 9417526ed0
commit addb1b1961
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -111,12 +111,23 @@
Condition="$(IsRootRepo) == 'true'" />
<Exec
Command="git clone $(CloneParam) $(RepoUri) $(SourceDir)"
WorkingDirectory="$(TarballSourceDir)"
Command="git init $(TarballRepoSourceDir)"
WorkingDirectory="$(RepoRoot)"
Condition="$(IsRootRepo) != 'true'" />
<Exec
Command="git checkout $(CloneParam) $(RepoSha)"
Command="git remote add origin $(RepoUri)"
WorkingDirectory="$(TarballRepoSourceDir)"
Condition="$(IsRootRepo) != 'true'" />
<!-- Fetching a sha requires git 2.5.0 or newer -->
<Exec
Command="git fetch origin $(RepoSha)"
WorkingDirectory="$(TarballRepoSourceDir)"
Condition="$(IsRootRepo) != 'true'" />
<Exec
Command="git reset --hard FETCH_HEAD"
WorkingDirectory="$(TarballRepoSourceDir)"
Condition="$(IsRootRepo) != 'true'" />