Compare commits
1 commit
04df6e42e0
...
3abfd103cf
Author | SHA1 | Date | |
---|---|---|---|
|
3abfd103cf |
4 changed files with 9 additions and 41 deletions
|
@ -175,7 +175,7 @@ def test_alt_template_with_condition(runner, paths, tst_arch):
|
|||
"""Test template with extra condition"""
|
||||
yadm_dir, yadm_data = setup_standard_yadm_dir(paths)
|
||||
|
||||
suffix = f"##template,arch.not{tst_arch}"
|
||||
suffix = f"##default,arch.not{tst_arch}"
|
||||
utils.create_alt_files(paths, suffix)
|
||||
run = runner([paths.pgm, "-Y", yadm_dir, "--yadm-data", yadm_data, "alt"])
|
||||
assert run.success
|
||||
|
|
|
@ -326,31 +326,3 @@ def test_no_repo(
|
|||
def verify_head(paths, branch):
|
||||
"""Assert the local repo has the correct head branch"""
|
||||
assert paths.repo.join("HEAD").read() == f"ref: refs/heads/{branch}\n"
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("remote")
|
||||
def test_clone_subdirectory(runner, paths, yadm_cmd, repo_config):
|
||||
"""Test clone from sub-directory of YADM_WORK"""
|
||||
|
||||
# clear out the work path
|
||||
paths.work.remove()
|
||||
paths.work.mkdir()
|
||||
|
||||
# create sub-directory
|
||||
subdir = paths.work.mkdir("subdir")
|
||||
|
||||
# determine remote url
|
||||
remote_url = f"file://{paths.remote}"
|
||||
|
||||
# run the clone command
|
||||
args = ["clone", "-w", paths.work, remote_url]
|
||||
run = runner(command=yadm_cmd(*args), cwd=subdir)
|
||||
|
||||
# clone should succeed, and repo should be configured properly
|
||||
assert successful_clone(run, paths, repo_config)
|
||||
|
||||
# ensure that no changes found as this is a clean dotfiles clone
|
||||
run = runner(command=yadm_cmd("status", "-uno", "--porcelain"), cwd=subdir)
|
||||
assert run.success
|
||||
assert run.out == ""
|
||||
assert run.err == ""
|
||||
|
|
|
@ -289,15 +289,15 @@ def test_template_recording(runner, yadm, cmd_generated):
|
|||
assert run.out.rstrip() == expected
|
||||
|
||||
|
||||
def test_underscores_and_upper_case_in_distro_and_family(runner, yadm):
|
||||
"""Test replacing spaces with underscores and lowering case in distro / distro_family"""
|
||||
def test_underscores_in_distro_and_family(runner, yadm):
|
||||
"""Test replacing spaces in distro / distro_family with underscores"""
|
||||
local_distro = "test distro"
|
||||
local_distro_family = "test family"
|
||||
filenames = {
|
||||
"filename##distro.Test Distro": 1004,
|
||||
"filename##distro.test distro": 1004,
|
||||
"filename##distro.test-distro": 0,
|
||||
"filename##distro.test_distro": 1004,
|
||||
"filename##distro_family.test FAMILY": 1008,
|
||||
"filename##distro_family.test family": 1008,
|
||||
"filename##distro_family.test-family": 0,
|
||||
"filename##distro_family.test_family": 1008,
|
||||
}
|
||||
|
|
12
yadm
12
yadm
|
@ -191,14 +191,10 @@ function score_file() {
|
|||
[ "$value" = "$local_system" ] && delta=2
|
||||
;;
|
||||
d|distro)
|
||||
shopt -s nocasematch
|
||||
[[ "${value// /_}" = "${local_distro// /_}" ]] && delta=4
|
||||
shopt -u nocasematch
|
||||
[ "${value// /_}" = "${local_distro// /_}" ] && delta=4
|
||||
;;
|
||||
f|distro_family)
|
||||
shopt -s nocasematch
|
||||
[[ "${value// /_}" = "${local_distro_family// /_}" ]] && delta=8
|
||||
shopt -u nocasematch
|
||||
[ "${value// /_}" = "${local_distro_family// /_}" ] && delta=8
|
||||
;;
|
||||
c|class)
|
||||
in_list "$value" "${local_classes[@]}" && delta=16
|
||||
|
@ -439,7 +435,7 @@ EOF
|
|||
-v distro="$local_distro" \
|
||||
-v distro_family="$local_distro_family" \
|
||||
-v source="$input" \
|
||||
-v source_dir="$(builtin_dirname "$input")" \
|
||||
-v source_dir="$(dirname "$input")" \
|
||||
"$awk_pgm" \
|
||||
"$input" "${local_classes[@]}" > "$temp_file" || rm -f "$temp_file"
|
||||
|
||||
|
@ -803,7 +799,7 @@ function clone() {
|
|||
rm -rf "$wc"
|
||||
|
||||
# then reset the index as the --no-checkout flag makes the index empty
|
||||
"$GIT_PROGRAM" reset --quiet -- ":/"
|
||||
"$GIT_PROGRAM" reset --quiet -- .
|
||||
|
||||
if [ "$YADM_WORK" = "$HOME" ]; then
|
||||
debug "Determining if repo tracks private directories"
|
||||
|
|
Loading…
Reference in a new issue