'Create a new commit.
:param message: Commit message
:param committer: Committer fullname
:param author: Author fullname (defaults to committer)
:param commit_timestamp: Commit timestamp (defaults to now)
:param commit_timezone: Commit timestamp timezone (defaults to GMT)
:param author_timestamp: Author timestamp (defaults to commit
timestamp)
:param author_timezone: Author timestamp timezone
(defaults to commit timestamp timezone)
:param tree: SHA1 of the tree root to use (if not specified the
current index will be committed).
:param encoding: Encoding
:param ref: Optional ref to commit to (defaults to current branch)
:param merge_heads: Merge heads (defaults to .git/MERGE_HEADS)
:return: New commit SHA1'

def do_commit(self, message=None, committer=None, author=None, commit_timestamp=None, commit_timezone=None, author_timestamp=None, author_timezone=None, tree=None, encoding=None, ref='HEAD', merge_heads=None):

    import time
    c = Commit()
    if (tree is None):
        index = self.open_index()
        c.tree = index.commit(self.object_store)
    else:
        if (len(tree) != 40):
            raise ValueError('tree    must    be    a    40-byte    hex    sha    string')
        c.tree = tree
    try:
        self.hooks['pre-commit'].execute()
    except HookError as e:
        raise CommitError(e)
    except KeyError:
        pass
    if (merge_heads is None):
        merge_heads = []
    if (committer is None):
        committer = self._get_user_identity()
    c.committer = committer
    if (commit_timestamp is None):
        commit_timestamp = time.time()
    c.commit_time = int(commit_timestamp)
    if (commit_timezone is None):
        commit_timezone = 0
    c.commit_timezone = commit_timezone
    if (author is None):
        author = committer
    c.author = author
    if (author_timestamp is None):
        author_timestamp = commit_timestamp
    c.author_time = int(author_timestamp)
    if (author_timezone is None):
        author_timezone = commit_timezone
    c.author_timezone = author_timezone
    if (encoding is not None):
        c.encoding = encoding
    if (message is None):
        raise ValueError('No    commit    message    specified')
    try:
        c.message = self.hooks['commit-msg'].execute(message)
        if (c.message is None):
            c.message = message
    except HookError as e:
        raise CommitError(e)
    except KeyError:
        c.message = message
    if (ref is None):
        c.parents = merge_heads
        self.object_store.add_object(c)
    else:
        try:
            old_head = self.refs[ref]
            c.parents = ([old_head] + merge_heads)
            self.object_store.add_object(c)
            ok = self.refs.set_if_equals(ref, old_head, c.id)
        except KeyError:
            c.parents = merge_heads
            self.object_store.add_object(c)
            ok = self.refs.add_if_new(ref, c.id)
        if (not ok):
            raise CommitError(('%s    changed    during    commit' % (ref,)))
    try:
        self.hooks['post-commit'].execute()
    except HookError as e:
        warnings.warn(('post-commit    hook    failed:    %s' % e), UserWarning)
    except KeyError:
        pass
    return c.id
