Skip to content

Commit

Permalink
other-test-repos/many-commits-fast-import.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cirosantilli committed Oct 1, 2020
1 parent eee1549 commit 37e5c34
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
4 changes: 3 additions & 1 deletion other-test-repos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Tests that are very large will not be included here to keep this repository smal
- <https://github.com/cirosantilli/test-deep>
- <https://github.com/cirosantilli/test-diff-many-files>
- <https://github.com/cirosantilli/test-pr-many-commits>
- <https://github.com/cirosantilli/test-many-commits-1m> [many-commits.py](many-commits.py)
- <https://github.com/cirosantilli/test-many-commits-1m>
- [many-commits.py](many-commits-fast-import.py) superior
- [many-commits.py](many-commits.py) inferior
- <https://github.com/cirosantilli/test-asciidoc-large-variable>

There are also some tests that could not be included here conveniently:
Expand Down
45 changes: 45 additions & 0 deletions other-test-repos/many-commits-fast-import.py
Original file line number Diff line number Diff line change
@@ -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))
2 changes: 2 additions & 0 deletions other-test-repos/many-commits.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 37e5c34

Please sign in to comment.