Skip to content

Commit

Permalink
Fix Repo.__repr__ when subclassed
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-matejka committed Dec 30, 2019
1 parent f7cff58 commit 08b0a91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion git/repo/base.py
Expand Up @@ -1064,7 +1064,8 @@ def has_separate_working_tree(self):
rev_parse = rev_parse

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

def currently_rebasing_on(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion git/test/test_repo.py
Expand Up @@ -362,7 +362,7 @@ def test_alternates(self):
self.rorepo.alternates = cur_alternates

def test_repr(self):
assert repr(self.rorepo).startswith('<git.Repo ')
assert repr(self.rorepo).startswith('<git.repo.base.Repo ')

def test_is_dirty_with_bare_repository(self):
orig_value = self.rorepo._bare
Expand Down

0 comments on commit 08b0a91

Please sign in to comment.