Merge pull request #42 from numberoverzero/master

Use --allow-empty for performance, resolves #32
This commit is contained in:
Eric Romano
2016-06-28 15:09:33 -04:00
committed by GitHub

View File

@ -281,14 +281,12 @@ def generate_values_in_date_order(image, multiplier=1):
yield image[h][w] * multiplier yield image[h][w] * multiplier
def commit(content, commitdate): def commit(commitdate):
template = ( template = (
'''echo {0} >> gitfiti\n''' '''GIT_AUTHOR_DATE={0} GIT_COMMITTER_DATE={1} '''
'''GIT_AUTHOR_DATE={1} GIT_COMMITTER_DATE={2} ''' '''git commit --allow-empty -m "gitfiti" > /dev/null\n'''
'''git commit -a -m "gitfiti" > /dev/null\n'''
) )
return template.format(content, commitdate.isoformat(), return template.format(commitdate.isoformat(), commitdate.isoformat())
commitdate.isoformat())
def fake_it(image, start_date, username, repo, git_url, offset=0, multiplier=1): def fake_it(image, start_date, username, repo, git_url, offset=0, multiplier=1):
@ -310,8 +308,8 @@ def fake_it(image, start_date, username, repo, git_url, offset=0, multiplier=1):
strings = [] strings = []
for value, date in zip(generate_values_in_date_order(image, multiplier), for value, date in zip(generate_values_in_date_order(image, multiplier),
generate_next_dates(start_date, offset)): generate_next_dates(start_date, offset)):
for i in range(value): for _ in range(value):
strings.append(commit(i, date)) strings.append(commit(date))
return template.format(repo, ''.join(strings), git_url, username) return template.format(repo, ''.join(strings), git_url, username)