-
Notifications
You must be signed in to change notification settings - Fork 111
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
OPT: Faster approach to GitRepo.get_hexsha() #4806
Conversation
Codecov Report
@@ Coverage Diff @@
## maint #4806 +/- ##
==========================================
- Coverage 89.67% 89.62% -0.05%
==========================================
Files 288 288
Lines 40352 40356 +4
==========================================
- Hits 36184 36168 -16
- Misses 4168 4188 +20
Continue to review full report at Codecov.
|
datalad/support/gitrepo.py
Outdated
# use --quiet because the 'Needed a single revision' error message | ||
# that is the result of running this in a repo with no commits | ||
# isn't useful to report | ||
cmd = ['rev-parse', '--verify', '{}^{{commit}}'.format( |
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 comment above mentions --quiet
, but it's not passed here.
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.
Arrgh, thx, wil fix.
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.
Force-pushed an update
The previous `git-show` can be slow with more complex commits (e.g. octopus merge commit, see datalad#4801) Switch to `git-rev-parse` instead as suggested by @kyleam in datalad#4801 (comment) Behavior of `GitRepo.get_hexsha()` should stay constant for all observed usage patterns. In particular raising a ValueError when querying for a specific, but non existent commitish is critical for subdataset handling. Fixes dataladgh-4801
The previous
git-show
can be slow with more complex commits (e.g.octopus merge commit, see
#4801)
Switch to
git-rev-parse
instead as suggested by @kyleam in#4801 (comment)
Behavior of
GitRepo.get_hexsha()
should stay constant for allobserved usage patterns. In particular raising a ValueError when
querying for a specific, but non existent commitish is critical
for subdataset handling.
Fixes gh-4801
I will tackle an analog change (using
git-log
) inGitRepo.format_commit()
in a separate PR.