Skip to content

add author and committer in params of the commit function #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 17, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add param to create_from_tree
  • Loading branch information
dralliw committed Mar 24, 2014
commit 5d602f267c32e1e917599d9bcdcfec4eef05d477
11 changes: 8 additions & 3 deletions git/objects/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def _iter_from_process_or_stream(cls, repo, proc_or_stream):


@classmethod
def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False):
def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False, author=None, committer=None):
"""Commit the given tree, creating a commit object.

:param repo: Repo object the commit should be part of
Expand Down Expand Up @@ -299,8 +299,13 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False):
cr = repo.config_reader()
env = os.environ

committer = Actor.committer(cr)
author = Actor.author(cr)
if author is None and committer is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This input check should be simplified.

committer = Actor.committer(cr)
author = Actor.author(cr)
elif author is None:
author = Actor.author(cr)
elif committer is None:
committer = Actor.committer(cr)

# PARSE THE DATES
unix_time = int(time())
Expand Down