summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-10-27 20:51:07 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-10-27 20:51:07 +0200
commit1b6b9510e0724bfcb4250f703ddf99d1e4020bbc (patch)
treecc59bebcb6cbc6a1a9210e4ff123f2a256105261
parent2c0b92e40ece170b59bced0cea752904823e06e7 (diff)
downloadgitpython-1b6b9510e0724bfcb4250f703ddf99d1e4020bbc.tar.gz
Fixed bug that would cause the author's email to be a generic default one, instead of the existing and valid. The rest of the ConfigParser handling is correct, as it reads all configuration files available to git
see http://github.com/Byron/GitPython/issues#issue/1
-rw-r--r--lib/git/config.py2
-rw-r--r--lib/git/objects/commit.py4
-rw-r--r--test/git/test_index.py9
3 files changed, 12 insertions, 3 deletions
diff --git a/lib/git/config.py b/lib/git/config.py
index 92d64aea..09bad0b6 100644
--- a/lib/git/config.py
+++ b/lib/git/config.py
@@ -136,7 +136,7 @@ class GitConfigParser(cp.RawConfigParser, object):
# initialize lock base - we want to write
self._lock = self.t_lock(file_or_files)
- self._lock._obtain_lock()
+ self._lock._obtain_lock()
# END read-only check
diff --git a/lib/git/objects/commit.py b/lib/git/objects/commit.py
index c7da01e8..58c82da2 100644
--- a/lib/git/objects/commit.py
+++ b/lib/git/objects/commit.py
@@ -52,8 +52,8 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
env_email = "EMAIL"
# CONFIGURATION KEYS
- conf_email = 'email'
conf_name = 'name'
+ conf_email = 'email'
conf_encoding = 'i18n.commitencoding'
# INVARIANTS
@@ -294,7 +294,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
conf_email = cr.get_value('user', cls.conf_email, default_email)
author_name = env.get(cls.env_author_name, conf_name)
- author_email = env.get(cls.env_author_email, default_email)
+ author_email = env.get(cls.env_author_email, conf_email)
committer_name = env.get(cls.env_committer_name, conf_name)
committer_email = env.get(cls.env_committer_email, conf_email)
diff --git a/test/git/test_index.py b/test/git/test_index.py
index 13d2c10d..29ad2b5c 100644
--- a/test/git/test_index.py
+++ b/test/git/test_index.py
@@ -353,6 +353,11 @@ class TestIndex(TestBase):
num_entries = len(index.entries)
cur_head = rw_repo.head
+ uname = "Some Developer"
+ umail = "sd@company.com"
+ rw_repo.config_writer().set_value("user", "name", uname)
+ rw_repo.config_writer().set_value("user", "email", umail)
+
# remove all of the files, provide a wild mix of paths, BaseIndexEntries,
# IndexEntries
def mixed_iterator():
@@ -404,6 +409,10 @@ class TestIndex(TestBase):
commit_message = "commit default head"
new_commit = index.commit(commit_message, head=False)
+ assert new_commit.author.name == uname
+ assert new_commit.author.email == umail
+ assert new_commit.committer.name == uname
+ assert new_commit.committer.email == umail
assert new_commit.message == commit_message
assert new_commit.parents[0] == cur_commit
assert len(new_commit.parents) == 1