diff --git a/git/objects/commit.py b/git/objects/commit.py index 8a84dd69b..302798cb2 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -269,7 +269,7 @@ def _iter_from_process_or_stream(cls, repo, proc_or_stream): # END handle extra info assert len(hexsha) == 40, "Invalid line: %s" % hexsha - yield Commit(repo, hex_to_bin(hexsha)) + yield cls(repo, hex_to_bin(hexsha)) # END for each line in stream # TODO: Review this - it seems process handling got a bit out of control # due to many developers trying to fix the open file handles issue diff --git a/test/test_commit.py b/test/test_commit.py index 0292545f0..7260a2337 100644 --- a/test/test_commit.py +++ b/test/test_commit.py @@ -199,6 +199,13 @@ def test_iteration(self): less_ltd_commits = list(Commit.iter_items(self.rorepo, 'master', paths=('CHANGES', 'AUTHORS'))) assert len(ltd_commits) < len(less_ltd_commits) + class Child(Commit): + def __init__(self, *args, **kwargs): + super(Child, self).__init__(*args, **kwargs) + + child_commits = list(Child.iter_items(self.rorepo, 'master', paths=('CHANGES', 'AUTHORS'))) + assert type(child_commits[0]) == Child + def test_iter_items(self): # pretty not allowed self.assertRaises(ValueError, Commit.iter_items, self.rorepo, 'master', pretty="raw")
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: