summaryrefslogtreecommitdiff
path: root/git/test/test_index.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-07 15:35:55 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-07 15:35:55 +0100
commitf4a49ff2dddc66bbe25af554caba2351fbf21702 (patch)
tree54ba82b7490038b911fc46bc1407cd7955bd7edf /git/test/test_index.py
parent45eb728554953fafcee2aab0f76ca65e005326b0 (diff)
parentc6ee00d0dadcd7b10d60a2985db4fe137ca7cfed (diff)
downloadgitpython-f4a49ff2dddc66bbe25af554caba2351fbf21702.tar.gz
Merge branch 'firm1-commit_by_actor'
Diffstat (limited to 'git/test/test_index.py')
-rw-r--r--git/test/test_index.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/git/test/test_index.py b/git/test/test_index.py
index f7504b32..4fdd3d1b 100644
--- a/git/test/test_index.py
+++ b/git/test/test_index.py
@@ -1,3 +1,4 @@
+#-*-coding:utf-8-*-
# test_index.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
@@ -10,6 +11,7 @@ from git.test.lib import (
fixture,
with_rw_repo
)
+from git.util import Actor
from git import (
IndexFile,
BlobFilter,
@@ -432,7 +434,7 @@ class TestIndex(TestBase):
# TEST COMMITTING
# commit changed index
cur_commit = cur_head.commit
- commit_message = "commit default head"
+ commit_message = u"commit default head by Frèderic Çaufl€"
new_commit = index.commit(commit_message, head=False)
assert cur_commit != new_commit
@@ -445,6 +447,23 @@ class TestIndex(TestBase):
assert len(new_commit.parents) == 1
assert cur_head.commit == cur_commit
+ # commit with other actor
+ cur_commit = cur_head.commit
+
+ my_author = Actor(u"Frèderic Çaufl€", "author@example.com")
+ my_committer = Actor(u"Committing Frèderic Çaufl€", "committer@example.com")
+ commit_actor = index.commit(commit_message, author=my_author, committer=my_committer)
+ assert cur_commit != commit_actor
+ assert commit_actor.author.name == u"Frèderic Çaufl€"
+ assert commit_actor.author.email == "author@example.com"
+ assert commit_actor.committer.name == u"Committing Frèderic Çaufl€"
+ assert commit_actor.committer.email == "committer@example.com"
+ assert commit_actor.message == commit_message
+ assert commit_actor.parents[0] == cur_commit
+ assert len(new_commit.parents) == 1
+ assert cur_head.commit == commit_actor
+ assert cur_head.log()[-1].actor == my_committer
+
# same index, no parents
commit_message = "index without parents"
commit_no_parents = index.commit(commit_message, parent_commits=list(), head=True)