Skip to content

Commit 6cb0965

Browse files
jan-matejkaByron
authored andcommitted
Fix Repo.__repr__ when subclassed
1 parent 91f6e62 commit 6cb0965

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: git/repo/base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,8 @@ def has_separate_working_tree(self):
10571057
rev_parse = rev_parse
10581058

10591059
def __repr__(self):
1060-
return '<git.Repo "%s">' % self.git_dir
1060+
clazz = self.__class__
1061+
return '<%s.%s %r>' % (clazz.__module__, clazz.__name__, self.git_dir)
10611062

10621063
def currently_rebasing_on(self):
10631064
"""

Diff for: git/test/test_repo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def test_alternates(self):
355355
self.rorepo.alternates = cur_alternates
356356

357357
def test_repr(self):
358-
assert repr(self.rorepo).startswith('<git.Repo ')
358+
assert repr(self.rorepo).startswith('<git.repo.base.Repo ')
359359

360360
def test_is_dirty_with_bare_repository(self):
361361
orig_value = self.rorepo._bare

0 commit comments

Comments
 (0)