Skip to content

Commit 0998fe5

Browse files
committed
many-commits-octopus-fast-import.py
1 parent 625747a commit 0998fe5

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

other-test-repos/filter-repo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def blob_callback(blob, callback_metadata):
1212
args = git_filter_repo.FilteringOptions.default_options()
1313
args.force = True
1414
args.partial = True
15-
args.refs = ['HEAD']
15+
args.refs = ['HEAD~..HEAD']
1616
args.repack=False
1717
args.replace_refs='update-no-add'
1818

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env python
2+
3+
'''
4+
This is a superior and simpler alternative to many-commits.py.
5+
6+
Usage:
7+
8+
rm -rf many-commits.tmp
9+
mkdir -p many-commits.tmp
10+
cd many-commits.tmp
11+
git init
12+
../many-commits-fast-import.py [ncommits=10] | git fast-import
13+
14+
Lenovo ThinkPad P51 SSD generation time for 2M commits: 33s. Disk usage: 270.2 MiB. Push size is smaller for some reason.
15+
'''
16+
17+
import sys
18+
19+
print('''blob
20+
mark :1
21+
data 1
22+
a
23+
reset refs/heads/master
24+
commit refs/heads/master
25+
mark :2
26+
author <> 0 +0000
27+
committer <> 0 +0000
28+
data 1
29+
30+
M 100644 :1 a
31+
''')
32+
33+
if len(sys.argv) > 1:
34+
n = int(sys.argv[1])
35+
else:
36+
n = 10
37+
for i in range(2, n + 2):
38+
print('''commit refs/heads/master
39+
mark :{}
40+
author <> {} +0000
41+
committer <> 0 +0000
42+
data 1
43+
44+
from :2
45+
'''.format(i + 1, i - 2))
46+
print('''commit refs/heads/master
47+
mark :{}
48+
author <> 0 +0000
49+
committer <> 0 +0000
50+
data 1
51+
52+
from :3'''.format(n + 3)
53+
)
54+
for i in range(4, n + 3):
55+
print('merge :{}'.format(i))

0 commit comments

Comments
 (0)