1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2025-06-04 00:23:58 +00:00
This commit is contained in:
Ian Chamberlain 2025-04-12 23:32:06 -04:00 committed by GitHub
commit 6ad82d0736
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -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
)

5
yadm
View File

@ -1785,7 +1785,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