mirror of
https://github.com/TheLocehiliosan/yadm
synced 2025-06-05 17:13:58 +00:00
Merge fff1aa9fa4
into bbb58e6625
This commit is contained in:
commit
6ad82d0736
@ -56,10 +56,14 @@ def test_alt_source(runner, paths, tracked, encrypt, exclude, yadm_alt):
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("ds1_copy")
|
@pytest.mark.usefixtures("ds1_copy")
|
||||||
@pytest.mark.parametrize("yadm_alt", [True, False], ids=["alt", "worktree"])
|
@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"""
|
"""Confirm links created are relative"""
|
||||||
yadm_dir, yadm_data = setup_standard_yadm_dir(paths)
|
yadm_dir, yadm_data = setup_standard_yadm_dir(paths)
|
||||||
|
|
||||||
|
if rel_worktree:
|
||||||
|
runner(yadm_cmd("gitconfig", "core.worktree", "../../../.."))
|
||||||
|
|
||||||
utils.create_alt_files(
|
utils.create_alt_files(
|
||||||
paths, "##default", tracked=True, encrypt=False, exclude=False, yadm_alt=yadm_alt, yadm_dir=yadm_dir
|
paths, "##default", tracked=True, encrypt=False, exclude=False, yadm_alt=yadm_alt, yadm_dir=yadm_dir
|
||||||
)
|
)
|
||||||
|
5
yadm
5
yadm
@ -1785,7 +1785,12 @@ function configure_paths() {
|
|||||||
# obtain YADM_WORK from repo if it exists
|
# obtain YADM_WORK from repo if it exists
|
||||||
if [ -d "$GIT_DIR" ]; then
|
if [ -d "$GIT_DIR" ]; then
|
||||||
local work
|
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)")
|
work=$(unix_path "$("$GIT_PROGRAM" config core.worktree)")
|
||||||
|
if [[ "$work" != /* ]]; then
|
||||||
|
work="$(cd "$GIT_DIR/$work" && pwd)"
|
||||||
|
fi
|
||||||
[ -n "$work" ] && YADM_WORK="$work"
|
[ -n "$work" ] && YADM_WORK="$work"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user