From 37e5c34111c4791d0ec06ce32d7d7843b648b66d Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Thu, 1 Oct 2020 04:00:03 +0000 Subject: [PATCH] other-test-repos/many-commits-fast-import.py --- other-test-repos/README.md | 4 +- other-test-repos/many-commits-fast-import.py | 45 ++++++++++++++++++++ other-test-repos/many-commits.py | 2 + 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100755 other-test-repos/many-commits-fast-import.py diff --git a/other-test-repos/README.md b/other-test-repos/README.md index b7797b8..2ccb264 100644 --- a/other-test-repos/README.md +++ b/other-test-repos/README.md @@ -7,7 +7,9 @@ Tests that are very large will not be included here to keep this repository smal - - - -- [many-commits.py](many-commits.py) +- + - [many-commits.py](many-commits-fast-import.py) superior + - [many-commits.py](many-commits.py) inferior - There are also some tests that could not be included here conveniently: diff --git a/other-test-repos/many-commits-fast-import.py b/other-test-repos/many-commits-fast-import.py new file mode 100755 index 00000000..a4ba643 --- /dev/null +++ b/other-test-repos/many-commits-fast-import.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +''' +This is a superior and simpler alternative to many-commits.py. + +Usage: + +rm -rf many-commits.tmp +mkdir -p many-commits.tmp +cd many-commits.tmp +git init +../many-commits-fast-import.py [ncommits=10] | git fast-import + +Lenovo ThinkPad P51 SSD generation time for 2M commits: 33s. Disk usage: 270.2 MiB. Push size is smaller for some reason. +''' + +import sys + +print('''blob +mark :1 +data 1 +a +reset refs/heads/master +commit refs/heads/master +mark :2 +author <> 0 +0000 +committer <> 0 +0000 +data 1 + +M 100644 :1 a +''') + +if len(sys.argv) > 1: + n = int(sys.argv[1]) +else: + n = 10 +for i in range(2, n + 1): + print('''commit refs/heads/master +mark :{} +author <> 0 +0000 +committer <> 0 +0000 +data 1 + +from :{} +'''.format(i + 1, i)) diff --git a/other-test-repos/many-commits.py b/other-test-repos/many-commits.py index 5dccf88..3c70202 100755 --- a/other-test-repos/many-commits.py +++ b/other-test-repos/many-commits.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 """ +many-commits-fast-import.py, is a simpler and better alternative to this, just use that!!! + Packing is important, or else deleting and pushing the generated repository could take a **huge** ammount of time. This method gets slower as it goes. 1M are fast to generate, but 10M require running for 24h nonstop.