YADM_WORK: allow for relative worktree paths #525
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Support relative paths in the yadm repo's
core.worktree
.What issues does this PR fix or reference?
Relates to #414
I ran into an issue when trying to reference the git dir across filesystem boundaries (for example, in WSL). An absolute worktree directory results in "invalid" file paths (i.e. nonexistent) when Windows reads the Linux absolute path, or vice versa.
I realize this is a pretty niche behavior but the change to make it work is fairly small, so I thought I'd submit a PR.
Previous Behavior
YADM_WORK
is set to the value ofcore.worktree
directly.New Behavior
If it does not begin with
/
, the value ofcore.worktree
is resolved to an absolute path relative toGIT_DIR
.This allows for a worktree path like
../../../..
which works across multiple platforms, allowing e.g. a Windows Git-bash clien to set a WSL yadm repo as a remote.Have tests been written for this change?
Yes
Have these commits been signed with GnuPG?
Yes
Please review yadm's Contributing Guide for best practices.