Skip to content

Commit e306802

Browse files
committed
added tests for commits with dates
1 parent 141b78f commit e306802

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

‎git/index/base.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,8 @@ def move(self, items, skip_errors=False, **kwargs):
922922

923923
returnout
924924

925-
defcommit(self, message, parent_commits=None, head=True, author=None, committer=None, author_date=None, commit_date=None):
925+
defcommit(self, message, parent_commits=None, head=True, author=None,
926+
committer=None, author_date=None, commit_date=None):
926927
"""Commit the current default index file, creating a commit object.
927928
For more information on the arguments, see tree.commit.
928929

‎git/test/test_index.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,17 @@ def mixed_iterator():
470470
assertcur_head.commit==commit_actor
471471
assertcur_head.log()[-1].actor==my_committer
472472

473+
# commit with author_date and commit_date
474+
cur_commit=cur_head.commit
475+
commit_message=u"commit with dates by Avinash Sajjanshetty"
476+
477+
new_commit=index.commit(commit_message, author_date="2006-04-07T22:13:13", commit_date="2005-04-07T22:13:13")
478+
assertcur_commit!=new_commit
479+
print(new_commit.authored_date, new_commit.committed_date)
480+
assertnew_commit.message==commit_message
481+
assertnew_commit.authored_date==1144447993
482+
assertnew_commit.committed_date==1112911993
483+
473484
# same index, no parents
474485
commit_message="index without parents"
475486
commit_no_parents=index.commit(commit_message, parent_commits=list(), head=True)

0 commit comments

Comments
(0)