1
+ #-*-coding:utf-8-*-
1
2
# test_index.py
2
3
# Copyright (C) 2008, 2009 Michael Trier ([email protected] ) and contributors
3
4
#
10
11
fixture ,
11
12
with_rw_repo
12
13
)
14
+ from git .util import Actor
13
15
from git import (
14
16
IndexFile ,
15
17
BlobFilter ,
@@ -432,7 +434,7 @@ def mixed_iterator():
432
434
# TEST COMMITTING
433
435
# commit changed index
434
436
cur_commit = cur_head .commit
435
- commit_message = "commit default head"
437
+ commit_message = u "commit default head by Frèderic Çaufl€ "
436
438
437
439
new_commit = index .commit (commit_message , head = False )
438
440
assert cur_commit != new_commit
@@ -445,6 +447,23 @@ def mixed_iterator():
445
447
assert len (new_commit .parents ) == 1
446
448
assert cur_head .commit == cur_commit
447
449
450
+ # commit with other actor
451
+ cur_commit = cur_head .commit
452
+
453
+ my_author = Actor (
u"Frèderic Çaufl€" ,
"[email protected] " )
454
+ my_committer = Actor (
u"Committing Frèderic Çaufl€" ,
"[email protected] " )
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 == "[email protected] "
459
+ assert commit_actor .committer .name == u"Committing Frèderic Çaufl€"
460
+ assert commit_actor .
committer .
email == "[email protected] "
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
+
448
467
# same index, no parents
449
468
commit_message = "index without parents"
450
469
commit_no_parents = index .commit (commit_message , parent_commits = list (), head = True )
0 commit comments