aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2023-08-24 02:12:00 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2023-08-24 02:37:36 +0200
commit360ac64b90ee16cc24bd4c574ec7e11760515a79 (patch)
tree8073e975a73b56fe18e6c3c32d348c21c93624ab
parent23f3f402fca346302fe424427ae4077d8a458cbb (diff)
downloadbitcoin-360ac64b90ee16cc24bd4c574ec7e11760515a79.tar.xz
test: previous releases: speed up fetching sources with shallow clone
For the sake of building previous releases, fetching the whole history of the repository for each version seems to be overkill as it takes much more time, bandwidth and disk space than necessary. Create a shallow clone instead with history truncated to the one commit of the version tag, which is directly checked out in the same command. This has the nice side-effect that we can remove the extra `git checkout` step after as it's not needed anymore. Note that it might look confusing to pass a _tag_ to a parameter named `--branch`, but the git-clone manpage explicitly states that this is supported.
-rwxr-xr-xtest/get_previous_releases.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/test/get_previous_releases.py b/test/get_previous_releases.py
index cfd6978c3e..cb1597503c 100755
--- a/test/get_previous_releases.py
+++ b/test/get_previous_releases.py
@@ -207,14 +207,11 @@ def build_release(tag, args) -> int:
print('Tag {} not found'.format(tag))
return 1
ret = subprocess.run([
- 'git', 'clone', githubUrl, tag
+ 'git', 'clone', f'--branch={tag}', '--depth=1', githubUrl, tag
]).returncode
if ret:
return ret
with pushd(tag):
- ret = subprocess.run(['git', 'checkout', tag]).returncode
- if ret:
- return ret
host = args.host
if args.depends:
with pushd('depends'):