Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/test_alt.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ def test_alt_source(runner, paths, tracked, encrypt, exclude, yadm_alt):

@pytest.mark.usefixtures("ds1_copy")
@pytest.mark.parametrize("yadm_alt", [True, False], ids=["alt", "worktree"])
def test_relative_link(runner, paths, yadm_alt):
@pytest.mark.parametrize("rel_worktree", [True, False], ids=["relative_work", "absolute_work"])
def test_relative_link(runner, paths, yadm_alt, yadm_cmd, rel_worktree):
"""Confirm links created are relative"""
yadm_dir, yadm_data = setup_standard_yadm_dir(paths)

if rel_worktree:
runner(yadm_cmd("gitconfig", "core.worktree", "../../../.."))

utils.create_alt_files(
paths, "##default", tracked=True, encrypt=False, exclude=False, yadm_alt=yadm_alt, yadm_dir=yadm_dir
)
Expand Down
5 changes: 5 additions & 0 deletions yadm
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,12 @@ function configure_paths() {
# obtain YADM_WORK from repo if it exists
if [ -d "$GIT_DIR" ]; then
local work
# It's possible this is a relative path, in which case it's relative to $GIT_DIR:
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreworktree
work=$(unix_path "$("$GIT_PROGRAM" config core.worktree)")
if [[ "$work" != /* ]]; then
work="$(cd "$GIT_DIR/$work" && pwd)"
fi
[ -n "$work" ] && YADM_WORK="$work"
fi

Expand Down
Loading