Tests: Simplify CTest.UpdateGIT repo path construction
Avoid constructing full paths to .git repositories in the test. Use relative paths and let Git convert them to absolute paths internally. This is simpler and also avoids trouble with various absolute path root component conventions on Windows (`c:/`, `/c/`, `/cygdrive/c/`).
This commit is contained in:
parent
fc6c5074e8
commit
972849fbb7
@ -41,7 +41,6 @@ run_child(
|
|||||||
COMMAND ${GIT} --bare init
|
COMMAND ${GIT} --bare init
|
||||||
)
|
)
|
||||||
file(REMOVE_RECURSE ${TOP}/repo.git/hooks)
|
file(REMOVE_RECURSE ${TOP}/repo.git/hooks)
|
||||||
set(REPO file://${TOP}/repo.git)
|
|
||||||
|
|
||||||
# Create submodule repository.
|
# Create submodule repository.
|
||||||
message("Creating submodule...")
|
message("Creating submodule...")
|
||||||
@ -51,17 +50,13 @@ run_child(
|
|||||||
COMMAND ${GIT} --bare init
|
COMMAND ${GIT} --bare init
|
||||||
)
|
)
|
||||||
file(REMOVE_RECURSE ${TOP}/module.git/hooks)
|
file(REMOVE_RECURSE ${TOP}/module.git/hooks)
|
||||||
set(MOD_REPO file://${TOP}/module.git)
|
run_child(WORKING_DIRECTORY ${TOP}
|
||||||
create_content(module)
|
COMMAND ${GIT} clone module.git module
|
||||||
run_child(WORKING_DIRECTORY ${TOP}/module
|
|
||||||
COMMAND ${GIT} init
|
|
||||||
)
|
)
|
||||||
file(REMOVE_RECURSE ${TOP}/module/.git/hooks)
|
file(REMOVE_RECURSE ${TOP}/module/.git/hooks)
|
||||||
file(APPEND ${TOP}/module/.git/config "
|
file(APPEND ${TOP}/module/.git/config "
|
||||||
[remote \"origin\"]
|
|
||||||
\turl = ${MOD_REPO}
|
|
||||||
\tfetch = +refs/heads/*:refs/remotes/origin/*
|
|
||||||
${AUTHOR_CONFIG}")
|
${AUTHOR_CONFIG}")
|
||||||
|
create_content(module)
|
||||||
run_child(WORKING_DIRECTORY ${TOP}/module
|
run_child(WORKING_DIRECTORY ${TOP}/module
|
||||||
COMMAND ${GIT} add .
|
COMMAND ${GIT} add .
|
||||||
)
|
)
|
||||||
@ -75,20 +70,17 @@ run_child(WORKING_DIRECTORY ${TOP}/module
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Import initial content into the repository.
|
# Import initial content into the repository.
|
||||||
message("Importing content...")
|
message("Importing content...")
|
||||||
create_content(import)
|
|
||||||
file(WRITE ${TOP}/import/HEAD "HEAD\n")
|
|
||||||
file(WRITE ${TOP}/import/master "master\n")
|
|
||||||
|
|
||||||
# Import the content into the repository.
|
# Import the content into the repository.
|
||||||
run_child(WORKING_DIRECTORY ${TOP}/import
|
run_child(WORKING_DIRECTORY ${TOP}
|
||||||
COMMAND ${GIT} init
|
COMMAND ${GIT} clone repo.git import
|
||||||
)
|
)
|
||||||
file(REMOVE_RECURSE ${TOP}/import/.git/hooks)
|
file(REMOVE_RECURSE ${TOP}/import/.git/hooks)
|
||||||
file(APPEND ${TOP}/import/.git/config "
|
file(APPEND ${TOP}/import/.git/config "
|
||||||
[remote \"origin\"]
|
|
||||||
\turl = ${REPO}
|
|
||||||
\tfetch = +refs/heads/*:refs/remotes/origin/*
|
|
||||||
${AUTHOR_CONFIG}")
|
${AUTHOR_CONFIG}")
|
||||||
|
create_content(import)
|
||||||
|
file(WRITE ${TOP}/import/HEAD "HEAD\n")
|
||||||
|
file(WRITE ${TOP}/import/master "master\n")
|
||||||
run_child(WORKING_DIRECTORY ${TOP}/import
|
run_child(WORKING_DIRECTORY ${TOP}/import
|
||||||
COMMAND ${GIT} add .
|
COMMAND ${GIT} add .
|
||||||
)
|
)
|
||||||
@ -96,7 +88,7 @@ run_child(WORKING_DIRECTORY ${TOP}/import
|
|||||||
COMMAND ${GIT} config core.safecrlf false
|
COMMAND ${GIT} config core.safecrlf false
|
||||||
)
|
)
|
||||||
run_child(WORKING_DIRECTORY ${TOP}/import
|
run_child(WORKING_DIRECTORY ${TOP}/import
|
||||||
COMMAND ${GIT} submodule add ${MOD_REPO} module
|
COMMAND ${GIT} submodule add ../module.git module
|
||||||
)
|
)
|
||||||
run_child(WORKING_DIRECTORY ${TOP}/import
|
run_child(WORKING_DIRECTORY ${TOP}/import
|
||||||
COMMAND ${GIT} commit -m "Initial content"
|
COMMAND ${GIT} commit -m "Initial content"
|
||||||
@ -123,7 +115,7 @@ run_child(WORKING_DIRECTORY ${TOP}/module
|
|||||||
message("Checking out revision 1...")
|
message("Checking out revision 1...")
|
||||||
run_child(
|
run_child(
|
||||||
WORKING_DIRECTORY ${TOP}
|
WORKING_DIRECTORY ${TOP}
|
||||||
COMMAND ${GIT} clone ${REPO} user-source
|
COMMAND ${GIT} clone repo.git user-source
|
||||||
)
|
)
|
||||||
file(REMOVE_RECURSE ${TOP}/user-source/.git/hooks)
|
file(REMOVE_RECURSE ${TOP}/user-source/.git/hooks)
|
||||||
file(APPEND ${TOP}/user-source/.git/config "${AUTHOR_CONFIG}")
|
file(APPEND ${TOP}/user-source/.git/config "${AUTHOR_CONFIG}")
|
||||||
@ -278,7 +270,7 @@ set(CTEST_GIT_COMMAND \"${GIT}\")
|
|||||||
set(CTEST_GIT_UPDATE_OPTIONS)
|
set(CTEST_GIT_UPDATE_OPTIONS)
|
||||||
execute_process(
|
execute_process(
|
||||||
WORKING_DIRECTORY \"${TOP}\"
|
WORKING_DIRECTORY \"${TOP}\"
|
||||||
COMMAND \"${GIT}\" clone \"${REPO}\" dash-source
|
COMMAND \"${GIT}\" clone repo.git dash-source
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test .git file.
|
# Test .git file.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user