-
Notifications
You must be signed in to change notification settings - Fork 13
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
Replace raw git bash commands with Gitpython #4
Conversation
It would be good to have some text in the description on why you're making this change. Is gitpython any better than vanilla git? |
@ulfjack Thanks for your comment. Updated the PR description. |
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.
Please don't merge the PR as but squash the commits in a way that each individual commit makes sense, e.g. no "fix commits".
benchmark.py
Outdated
def _get_commits(commits_list, repo, flag_name): | ||
"""Returns a list of commits. | ||
|
||
If the input commits_list is empty, fetch the latest commit from 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.
really the latest commit or the latest in master
?
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.
Fixed.
As discussed offline, I always use "Squash and merge" for PRs in this repository. Disabled the "Merge commits" option in the repository settings to be sure.
For the first point mentioned in the description: it would seem odd if there wasn't an api to set the working directory for a subprocess without calling chdir. |
@ulfjack You're right, there's an option to do that. With that in mind, reason no. 2 would be the main motivation for this change. |
Why?
We've been calling "raw"
git
commands withsubprocess
. This has a few disadvantages:Requires the internal navigation to various directories withos.chdir
. This is prone to obscure bugs e.g. if one forgets to change back to the correct directory.We have been using the string "latest" to represent this. It's fine in the context of running the script in the command line and immediately consume the result, but on BigQuery it's wrong since "latest" at different points in time mean different commits.
GitPython addresses these issues.
Changes: