◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
2 changes: 2 additions & 0 deletions git/index/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,7 @@ def commit(
author_date: Union[datetime.datetime, str, None] = None,
commit_date: Union[datetime.datetime, str, None] = None,
skip_hooks: bool = False,
) -> Commit:
"""Commit the current default index file, creating a
:class:`~git.objects.commit.Commit` object.
Expand Down Expand Up @@ -1169,6 +1170,7 @@ def commit(
committer=committer,
author_date=author_date,
commit_date=commit_date,
)
if not skip_hooks:
run_commit_hook("post-commit", self)
32 changes: 32 additions & 0 deletions git/objects/commit.py
Original file line number Diff line number Diff line change
@@ -570,6 +570,7 @@ def create_from_tree(
committer: Union[None, Actor] = None,
author_date: Union[None, str, datetime.datetime] = None,
commit_date: Union[None, str, datetime.datetime] = None,
) -> "Commit":
"""Commit the given tree, creating a :class:`Commit` object.

Expand Down Expand Up @@ -609,6 +610,14 @@ def create_from_tree(
:param commit_date:
The timestamp for the committer field.

:return:
:class:`Commit` object representing the new commit.

Expand Down Expand Up @@ -678,6 +687,29 @@ def create_from_tree(
tree = repo.tree(tree)
# END tree conversion

# CREATE NEW COMMIT
new_commit = cls(
repo,
Expand Down
74 changes: 74 additions & 0 deletions test/test_commit.py
Original file line number Diff line number Diff line change
@@ -566,3 +566,77 @@ def test_commit_co_authors(self):
Actor("test_user_2", "another_user-email@github.com"),
Actor("test_user_3", "test_user_3@github.com"),
]
Loading
Toggle all file notes Toggle all file annotations