Skip to content

Commit

Permalink
many-commits-octopus-fast-import.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cirosantilli committed Dec 4, 2020
1 parent 625747a commit 0998fe5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion other-test-repos/filter-repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def blob_callback(blob, callback_metadata):
args = git_filter_repo.FilteringOptions.default_options()
args.force = True
args.partial = True
args.refs = ['HEAD']
args.refs = ['HEAD~..HEAD']
args.repack=False
args.replace_refs='update-no-add'

Expand Down
55 changes: 55 additions & 0 deletions other-test-repos/many-commits-octopus-fast-import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/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 + 2):
print('''commit refs/heads/master
mark :{}
author <> {} +0000
committer <> 0 +0000
data 1
from :2
'''.format(i + 1, i - 2))
print('''commit refs/heads/master
mark :{}
author <> 0 +0000
committer <> 0 +0000
data 1
from :3'''.format(n + 3)
)
for i in range(4, n + 3):
print('merge :{}'.format(i))

0 comments on commit 0998fe5

Please sign in to comment.