1+ #-*-coding:utf-8-*-
12# test_index.py
23# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
34#
1011 fixture ,
1112 with_rw_repo
1213)
14+ from git .util import Actor
1315from git import (
1416 IndexFile ,
1517 BlobFilter ,
@@ -432,7 +434,7 @@ def mixed_iterator():
432434 # TEST COMMITTING
433435 # commit changed index
434436 cur_commit = cur_head .commit
435- commit_message = "commit default head"
437+ commit_message = u "commit default head by Frèderic Çaufl€ "
436438
437439 new_commit = index .commit (commit_message , head = False )
438440 assert cur_commit != new_commit
@@ -445,6 +447,23 @@ def mixed_iterator():
445447 assert len (new_commit .parents ) == 1
446448 assert cur_head .commit == cur_commit
447449
450+ # commit with other actor
451+ cur_commit = cur_head .commit
452+
453+ my_author = Actor (u"Frèderic Çaufl€" , "author@example.com" )
454+ my_committer = Actor (u"Committing Frèderic Çaufl€" , "committer@example.com" )
455+ commit_actor = index .commit (commit_message , author = my_author , committer = my_committer )
456+ assert cur_commit != commit_actor
457+ assert commit_actor .author .name == u"Frèderic Çaufl€"
458+ assert commit_actor .author .email == "author@example.com"
459+ assert commit_actor .committer .name == u"Committing Frèderic Çaufl€"
460+ assert commit_actor .committer .email == "committer@example.com"
461+ assert commit_actor .message == commit_message
462+ assert commit_actor .parents [0 ] == cur_commit
463+ assert len (new_commit .parents ) == 1
464+ assert cur_head .commit == commit_actor
465+ assert cur_head .log ()[- 1 ].actor == my_committer
466+
448467 # same index, no parents
449468 commit_message = "index without parents"
450469 commit_no_parents = index .commit (commit_message , parent_commits = list (), head = True )
0 commit comments