-
Notifications
You must be signed in to change notification settings - Fork 113
Preserve final trailing slash in call_git()
output
#6754
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
Preserve final trailing slash in call_git()
output
#6754
Conversation
In principle IMHO it is a bug and worth submitting against maint , but given subtle nature and rarely be an issue, master might indeed be more appropriate. |
eh FML I keep forgetting to adjust the PR target. Sorry :( |
Yet lacks input what the env parameter is
…ng slashes Rational is in datalad#6278 (comment)
30b384c
to
e36c190
Compare
I have rebased onto maint, extended tuneup of the docstring, force pushed and changed the base to be If no failures and no objections are stated (inviting @christian-monch for review), I think we should merge it and take ukbiobank out of hostage situation. |
Code Climate has analyzed commit e36c190 and detected 0 issues on this pull request. View more on Code Climate. |
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.
I don't think this is the way to go.
This changes the underlying call from _generator_call_git
to _call_git
if I'm not mistaken. Hence, the change does something substantially different from its actual aim.
How about call_git_items_
simply getting an option to not swallow an empty line at the end?
Alternatively, one could think about a more specialized helper for cat-file
, since it's a somewhat different usecase to read a file content from getting other kinds of results from git calls.
I guess we really need insights from @christian-monch |
e36c190
to
9a25d23
Compare
I think it didn't survive change of the base neatly... I have force pushed rewritten last commit to get CI redo it |
seems like legit/intended fail here since now we would have a trailing new line |
I think @adswa s PR is fine. The previous state was:
The current state is:
Both are almost equivalent besides the fact that Edit: Edit: issue #6766 created |
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.
IMO this is a good solution for the problem. The only fly in the ointment is that stderr-output is recorded and ignored, but correctness and PR simplicity should trump performance considerations.
The tests should be modified to reflect the updated behavior. I.e. something like this:
diff --git a/datalad/tests/test_config.py b/datalad/tests/test_config.py
index b5bc4f3ae..a9e171557 100644
--- a/datalad/tests/test_config.py
+++ b/datalad/tests/test_config.py
@@ -641,7 +641,7 @@ def test_global_config():
def test_bare(src, path):
# create a proper datalad dataset with all bells and whistles
ds = Dataset(src).create()
- dlconfig_sha = ds.repo.call_git(['rev-parse', 'HEAD:.datalad/config'])
+ dlconfig_sha = ds.repo.call_git(['rev-parse', 'HEAD:.datalad/config']).strip()
# can we handle a bare repo version of it?
gr = AnnexRepo.clone(
src, path, clone_options=['--bare', '-b', DEFAULT_BRANCH])
This commit adapts a test that did not expect a trailing newline on the result of 'GitRepo.call_git()' because the previous version would not return a trailing newline, but the current version does.
Pushed a fix for the tests |
call_git()
outputcall_git()
output
Thanks @adswa for the nice fix. |
Indeed, pushed an updated test |
Codecov Report
@@ Coverage Diff @@
## maint #6754 +/- ##
==========================================
+ Coverage 91.18% 91.20% +0.01%
==========================================
Files 353 354 +1
Lines 44528 44616 +88
==========================================
+ Hits 40604 40691 +87
- Misses 3924 3925 +1
Continue to review full report at Codecov.
|
🚀 PR was released in |
A failure in
datalad-ukbiobank
(datalad/datalad-ukbiobank#82 and a misguided fix in datalad/datalad-ukbiobank#85 has revealed that a change introduced in #6278 caused final trailing newlines to be removed from the final stdout of ourcall_git
calls. In datalad-ukb, unit tests started to fail as the contents of files that were written withgit cat-file -p <sourcebranch>:<sourcefile>
lacked the trailing newlines that the source files had.I'm poking in the dark and PRing a WIP PR in hopes of improvements and feedback to fix this by switching back to
_call_git()
fromcall_git_items()
. The PR also contains half of a docstring fix @yarikoptic idenitified - input on the description of theenv
parameter (see commit) would be appreciated.