Skip to content
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

BF(?WIN): provide relpath relative to dataset not default CWD #6352

Merged
merged 2 commits into from
Jan 19, 2022

Conversation

yarikoptic
Copy link
Member

Trying to address the #2 fail listed in #6237 and happening somehow only on master . Due to absent comments I assume that relpath was used to provide a shortened path to the message file. Given that dataset could point somewhere else (including another drive on windows) and os.curdir is used by relpath if source is not specified , I decided to just provide start to be the dataset path explicitly.
I failed to reproduce #6237 locally, so it is somewhat a wild shot, but what could go wrong? only reporting could be effected.

@mih
Copy link
Member

mih commented Jan 18, 2022

Thx!

I cannot submit a proper suggesting, so doing it like this:

was:

    msg_path = opj(str(repo.dot_git), "COMMIT_EDITMSG")
    # shorten to the relative path for a more concise message
    msg_path = relpath(msg_path, ds_path)
    with open(msg_path, "wb") as ofh:
        ofh.write(ensure_bytes(msg))
    lgr.info("The command had a non-zero exit code. "
                "If this is expected, you can save the changes with "
                "'datalad save -d . -r -F %s'",
                msg_path)

could be

    msg_path = repo.dot_git / "COMMIT_EDITMSG"
    msg_path.write_text(msg)
    lgr.info("The command had a non-zero exit code. "
                "If this is expected, you can save the changes with "
                "'datalad save -d . -r -F %s'",
                # shorten to the relative path for a more concise message
                msg_path.relative_to(ds.pathobj)

@yarikoptic yarikoptic added the semver-patch Increment the patch version when merged label Jan 18, 2022
@yarikoptic
Copy link
Member Author

thanks @mih, applied

@codecov
Copy link

codecov bot commented Jan 18, 2022

Codecov Report

Merging #6352 (c406a2b) into master (f3cbb0c) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6352      +/-   ##
==========================================
- Coverage   89.84%   89.84%   -0.01%     
==========================================
  Files         331      331              
  Lines       43207    43206       -1     
==========================================
- Hits        38819    38818       -1     
  Misses       4388     4388              
Impacted Files Coverage Δ
datalad/core/local/run.py 97.80% <100.00%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f3cbb0c...c406a2b. Read the comment docs.

@yarikoptic
Copy link
Member Author

ok, changed code is tests covered (not sure how much checked) and I took recommended changes. Let's proceed and improve/fix if needed after. Cheers!

@yarikoptic yarikoptic merged commit 6ea63a9 into datalad:master Jan 19, 2022
@yarikoptic yarikoptic deleted the bf-rerun-relpath branch January 20, 2022 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch Increment the patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants