From 8f51abd30647c9dfe857621ab97f52d3e5f2fbd9 Mon Sep 17 00:00:00 2001 From: SergeantMenacingGarlic <87030047+SergeantMenacingGarlic@users.noreply.github.com> Date: Mon, 10 Oct 2022 16:13:36 -0400 Subject: [PATCH] Add datetime.datetime type to commit_date and author_date --- git/index/base.py | 5 +++-- git/objects/commit.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/git/index/base.py b/git/index/base.py index 10f8b8b25..17d18db58 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -4,6 +4,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php +import datetime import glob from io import BytesIO import os @@ -1032,8 +1033,8 @@ def commit( head: bool = True, author: Union[None, "Actor"] = None, committer: Union[None, "Actor"] = None, - author_date: Union[str, None] = None, - commit_date: Union[str, None] = None, + 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 commit object. diff --git a/git/objects/commit.py b/git/objects/commit.py index cf7d9aaa2..82d2387b3 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -435,8 +435,8 @@ def create_from_tree( head: bool = False, author: Union[None, Actor] = None, committer: Union[None, Actor] = None, - author_date: Union[None, str] = None, - commit_date: Union[None, str] = None, + author_date: Union[None, str, datetime.datetime] = None, + commit_date: Union[None, str, datetime.datetime] = None, ) -> "Commit": """Commit the given tree, creating a commit object.