Skip to content

Fix Repo.__repr__ when subclassed #968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion git/repo/base.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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