Merge aba434274e
into ec10041024
This commit is contained in:
commit
dc94081554
2 changed files with 30 additions and 1 deletions
|
@ -326,3 +326,32 @@ def test_no_repo(
|
||||||
def verify_head(paths, branch):
|
def verify_head(paths, branch):
|
||||||
"""Assert the local repo has the correct head branch"""
|
"""Assert the local repo has the correct head branch"""
|
||||||
assert paths.repo.join("HEAD").read() == f"ref: refs/heads/{branch}\n"
|
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]
|
||||||
|
args += [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)
|
||||||
|
|
||||||
|
# test that the conflicts are preserved in the work tree
|
||||||
|
run = runner(command=yadm_cmd("status", "-uno", "--porcelain"), cwd=subdir)
|
||||||
|
assert run.success
|
||||||
|
assert run.out == ""
|
||||||
|
assert run.err == ""
|
||||||
|
|
2
yadm
2
yadm
|
@ -853,7 +853,7 @@ function clone() {
|
||||||
rm -rf "$wc"
|
rm -rf "$wc"
|
||||||
|
|
||||||
# then reset the index as the --no-checkout flag makes the index empty
|
# then reset the index as the --no-checkout flag makes the index empty
|
||||||
"$GIT_PROGRAM" reset --quiet -- .
|
"$GIT_PROGRAM" reset --quiet -- "$YADM_WORK"
|
||||||
|
|
||||||
if [ "$YADM_WORK" = "$HOME" ]; then
|
if [ "$YADM_WORK" = "$HOME" ]; then
|
||||||
debug "Determining if repo tracks private directories"
|
debug "Determining if repo tracks private directories"
|
||||||
|
|
Loading…
Reference in a new issue