| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -276,14 +276,17 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False, | |||
| 276 | 276 | If True, the HEAD will be advanced to the new commit automatically. | |
| 277 | 277 | Else the HEAD will remain pointing on the previous commit. This could | |
| 278 | 278 | 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. | ||
| 279 | 283 | ||
| 280 | 284 | :return: Commit object representing the new commit | |
| 281 | 285 | ||
| 282 | 286 | :note: | |
| 283 | 287 | Additional information about the committer and Author are taken from the | |
| 284 | 288 | environment or from the git configuration, see git-commit-tree for | |
| 285 | 289 | more information""" | |
| 286 | - parents = parent_commits | ||
| 287 | 290 | if parent_commits is None: | |
| 288 | 291 | try: | |
| 289 | 292 | parent_commits = [repo.head.commit] | |
@@ -357,7 +360,6 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False, | |||
| 357 | 360 | except ValueError: | |
| 358 | 361 | # head is not yet set to the ref our HEAD points to | |
| 359 | 362 | # Happens on first commit | |
| 360 | - import git.refs | ||
| 361 | 363 | master = git.refs.Head.create(repo, repo.head.ref, new_commit, logmsg="commit (initial): %s" % message) | |
| 362 | 364 | repo.head.set_reference(master, logmsg='commit: Switching to %s' % master) | |
| 363 | 365 | # END handle empty repositories | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -356,10 +356,16 @@ def log_append(self, oldbinsha, message, newbinsha=None): | |||
| 356 | 356 | will be used | |
| 357 | 357 | :return: added RefLogEntry instance""" | |
| 358 | 358 | # 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 | - return RefLog.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 | + except ValueError: | ||
| 364 | + committer_or_reader = self.repo.config_reader() | ||
| 365 | + # end handle newly cloned repositories | ||
| 366 | + return RefLog.append_entry(committer_or_reader, RefLog.path(self), oldbinsha, | ||
| 361 | 367 | (newbinsha is None and self.commit.binsha) or newbinsha, | |
| 362 | - message) | ||
| 368 | + message) | ||
| 363 | 369 | ||
| 364 | 370 | def log_entry(self, index): | |
| 365 | 371 | """:return: RefLogEntry at the given index | |
| Back | FazBrowse Home | New Git URL |
0 commit comments