-
Notifications
You must be signed in to change notification settings - Fork 4
add gitinfo class #106
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
add gitinfo class #106
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See suggestion about testing.
for line in self.run_git(["branch"]): | ||
if "HEAD detached" in line: | ||
result = self.detached_head_reference | ||
break | ||
else: | ||
raise GitBDiffError("unable to get branch name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chunk of code isn't currently being tested. I think it should be easy to check out a detached head in the test repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Have also added a couple of init.py files and a relative import, so now the unit tests can be run by just pytest
from the bdiff directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code for this looks great, I have one small suggestion regarding documenting the use of a walrus operator as this is something I had to look up otherwise I'm happy to hit approve on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This walrus is now very happy. Approved.
Description
Add a new class to bdiff as somewhere to get other info about a branch. For now include a function testing whether the branch provided is "main-like". This is useful for some UM tests, where we want to decide whether to run over a branch diff or the full trunk.
Checklist