diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2014-11-17 10:59:39 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2014-11-17 10:59:39 +0100 |
commit | ba67e4ff74e97c4de5d980715729a773a48cd6bc (patch) | |
tree | 9e557ba5b510b2d68046481e8d185321dd88860b | |
parent | 9780b7a0f39f66d6e1946a7d109fc49165b81d64 (diff) | |
download | gitpython-ba67e4ff74e97c4de5d980715729a773a48cd6bc.tar.gz |
Assure API remains backwards compatible; update API docs
-rw-r--r-- | git/objects/commit.py | 6 | ||||
-rw-r--r-- | git/refs/symbolic.py | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/git/objects/commit.py b/git/objects/commit.py index 9ec58c52..453afe66 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -276,6 +276,10 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): If True, the HEAD will be advanced to the new commit automatically. Else the HEAD will remain pointing on the previous commit. This could lead to undesired results when diffing files. + :param author: The name of the author, optional. If unset, the repository + configuration is used to obtain this value. + :param committer: The name of the committer, optional. If unset, the + repository configuration is used to obtain this value. :return: Commit object representing the new commit @@ -283,7 +287,6 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): Additional information about the committer and Author are taken from the environment or from the git configuration, see git-commit-tree for more information""" - parents = parent_commits if parent_commits is None: try: parent_commits = [repo.head.commit] @@ -357,7 +360,6 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): except ValueError: # head is not yet set to the ref our HEAD points to # Happens on first commit - import git.refs master = git.refs.Head.create(repo, repo.head.ref, new_commit, logmsg="commit (initial): %s" % message) repo.head.set_reference(master, logmsg='commit: Switching to %s' % master) # END handle empty repositories diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index eb11627d..9a95b7f0 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -356,10 +356,16 @@ class SymbolicReference(object): will be used :return: added RefLogEntry instance""" # NOTE: we use the committer of the currently active commit - this should be - # correct. See https://github.com/gitpython-developers/GitPython/pull/146 - return RefLog.append_entry(self.commit.committer, RefLog.path(self), oldbinsha, + # correct to allow overriding the committer on a per-commit level. + # See https://github.com/gitpython-developers/GitPython/pull/146 + try: + committer_or_reader = self.commit.committer + except ValueError: + committer_or_reader = self.repo.config_reader() + # end handle newly cloned repositories + return RefLog.append_entry(committer_or_reader, RefLog.path(self), oldbinsha, (newbinsha is None and self.commit.binsha) or newbinsha, - message) + message) def log_entry(self, index): """:return: RefLogEntry at the given index |