aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-12-02 09:45:14 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-12-02 10:37:19 +0100
commit6e619b06d7c9af4a95916485ac46825947abf7e8 (patch)
treef02861080e757b122b8223d3996bd643935512ec /cmake
parent5bbec95c482e1afa9bf217f28f9bfc47a170b745 (diff)
Checkout as detached if checking out branch fails
Having several toplevel worktrees for the same branch is problematic, but but we do want to be able to have one toplevel worktree synchronized to e.g. one submodule's dev and another with all submodules at the respective dev heads. So fall back to detached checkout if regular checkout fails, and generate a warning. Change-Id: I13981ab931cbbd8b56187979708bfe63f7373718 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtTopLevelHelpers.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmake/QtTopLevelHelpers.cmake b/cmake/QtTopLevelHelpers.cmake
index 990013f5..6287d935 100644
--- a/cmake/QtTopLevelHelpers.cmake
+++ b/cmake/QtTopLevelHelpers.cmake
@@ -131,6 +131,15 @@ function(qt_internal_checkout module revision)
RESULT_VARIABLE git_result
${swallow_output}
)
+ if (git_result EQUAL 128)
+ message(WARNING "${git_output}, trying detached checkout")
+ execute_process(
+ COMMAND "git" "checkout" "--detach" "${revision}"
+ WORKING_DIRECTORY "./${module}"
+ RESULT_VARIABLE git_result
+ ${swallow_output}
+ )
+ endif()
if (git_result)
message(FATAL_ERROR "Failed to check '${module}' out to '${revision}': ${git_output}")
endif()