Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitba67e4f

Browse files
committed
Assure API remains backwards compatible; update API docs
1 parent9780b7a commitba67e4f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

‎git/objects/commit.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,17 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False,
276276
If True, the HEAD will be advanced to the new commit automatically.
277277
Else the HEAD will remain pointing on the previous commit. This could
278278
lead to undesired results when diffing files.
279+
:param author: The name of the author, optional. If unset, the repository
280+
configuration is used to obtain this value.
281+
:param committer: The name of the committer, optional. If unset, the
282+
repository configuration is used to obtain this value.
279283
280284
:return: Commit object representing the new commit
281285
282286
:note:
283287
Additional information about the committer and Author are taken from the
284288
environment or from the git configuration, see git-commit-tree for
285289
more information"""
286-
parents=parent_commits
287290
ifparent_commitsisNone:
288291
try:
289292
parent_commits= [repo.head.commit]
@@ -357,7 +360,6 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False,
357360
exceptValueError:
358361
# head is not yet set to the ref our HEAD points to
359362
# Happens on first commit
360-
importgit.refs
361363
master=git.refs.Head.create(repo,repo.head.ref,new_commit,logmsg="commit (initial): %s"%message)
362364
repo.head.set_reference(master,logmsg='commit: Switching to %s'%master)
363365
# END handle empty repositories

‎git/refs/symbolic.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,16 @@ def log_append(self, oldbinsha, message, newbinsha=None):
356356
will be used
357357
:return: added RefLogEntry instance"""
358358
# NOTE: we use the committer of the currently active commit - this should be
359-
# correct. See https://github.com/gitpython-developers/GitPython/pull/146
360-
returnRefLog.append_entry(self.commit.committer,RefLog.path(self),oldbinsha,
359+
# correct to allow overriding the committer on a per-commit level.
360+
# See https://github.com/gitpython-developers/GitPython/pull/146
361+
try:
362+
committer_or_reader=self.commit.committer
363+
exceptValueError:
364+
committer_or_reader=self.repo.config_reader()
365+
# end handle newly cloned repositories
366+
returnRefLog.append_entry(committer_or_reader,RefLog.path(self),oldbinsha,
361367
(newbinshaisNoneandself.commit.binsha)ornewbinsha,
362-
message)
368+
message)
363369

364370
deflog_entry(self,index):
365371
""":return: RefLogEntry at the given index

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp