mirror of
git://code.qt.io/qt/qt5.git
synced 2026-09-10 02:57:57 +08:00
init-repository: add --depth argument
There are cases when someone may only want to do a shallow clone, e.g. in CI scenarios. Adding a --depth argument to reflect to allow shallow clones of the (sub)modules. Change-Id: Ia57f6d70c61eeb8f9828c467c8a4cf31c1d9c573 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
@@ -181,6 +181,7 @@ function(qt_ir_clone_one_submodule submodule_name)
|
||||
set(oneValueArgs
|
||||
ALTERNATES
|
||||
BASE_URL
|
||||
DEPTH
|
||||
WORKING_DIRECTORY
|
||||
)
|
||||
set(multiValueArgs "")
|
||||
@@ -263,6 +264,9 @@ function(qt_ir_clone_one_submodule submodule_name)
|
||||
else()
|
||||
list(APPEND clone_args --no-checkout)
|
||||
endif()
|
||||
if(arg_DEPTH)
|
||||
list(APPEND clone_args --depth "${arg_DEPTH}")
|
||||
endif()
|
||||
list(APPEND clone_args ${progress_args})
|
||||
qt_ir_execute_process_and_log_and_handle_error(
|
||||
COMMAND_ARGS git clone ${clone_args} "${mirror_or_original_url}" "${submodule_path}"
|
||||
@@ -1063,6 +1067,7 @@ function(qt_ir_handle_init_submodules prefix)
|
||||
set(oneValueArgs
|
||||
ALTERNATES
|
||||
BASE_URL
|
||||
DEPTH
|
||||
PARENT_REPO_BASE_GIT_PATH
|
||||
WORKING_DIRECTORY
|
||||
)
|
||||
@@ -1123,6 +1128,7 @@ function(qt_ir_handle_init_submodules prefix)
|
||||
qt_ir_clone_one_submodule(${submodule_name}
|
||||
ALTERNATES ${arg_ALTERNATES}
|
||||
BASE_URL ${arg_BASE_URL}
|
||||
DEPTH "${arg_DEPTH}"
|
||||
WORKING_DIRECTORY "${working_directory}"
|
||||
${branch_flag}
|
||||
${fetch_flag}
|
||||
@@ -1163,6 +1169,7 @@ function(qt_ir_handle_init_submodules prefix)
|
||||
SUBMODULES "all"
|
||||
|
||||
BASE_URL "${base_url}"
|
||||
DEPTH "${arg_DEPTH}"
|
||||
PARENT_REPO_BASE_GIT_PATH "${submodule_base_git_path}"
|
||||
WORKING_DIRECTORY "${working_directory}/${submodule_name}"
|
||||
|
||||
|
||||
@@ -122,6 +122,16 @@ Options:
|
||||
|
||||
Note that this negates the disk usage benefits gained from the use
|
||||
of `--alternates'.
|
||||
|
||||
--depth <n>
|
||||
Creates a shallow clone with a history truncated to <n> commits for
|
||||
each submodule that is cloned, by passing `--depth <n>' to `git
|
||||
clone'. This also applies recursively to submodules of submodules
|
||||
(e.g. qtwebengine's third-party dependencies).
|
||||
|
||||
This option only affects submodules that are freshly cloned; it has
|
||||
no effect on already-cloned submodules that are merely updated or
|
||||
fetched.
|
||||
--mirror <url-base>
|
||||
Uses <url-base> as the base URL for submodule git mirrors.
|
||||
|
||||
|
||||
@@ -312,6 +312,7 @@ function(qt_ir_run_after_args_parsed top_level_src_path out_var_exit_reason)
|
||||
# Get some additional options to pass down.
|
||||
qt_ir_get_option_as_existing_absolute_path(alternates alternates)
|
||||
qt_ir_get_option_as_cmake_flag_option(branch "CHECKOUT_BRANCH" checkout_branch_option)
|
||||
qt_ir_get_option_value(depth depth)
|
||||
|
||||
# The prefix for the cmake-style 'dictionary' that will be used by various functions.
|
||||
set(prefix "ir_top")
|
||||
@@ -321,6 +322,7 @@ function(qt_ir_run_after_args_parsed top_level_src_path out_var_exit_reason)
|
||||
ALTERNATES "${alternates}"
|
||||
ALREADY_INITIALIZED_SUBMODULES "${already_initialized_submodules}"
|
||||
BASE_URL "${base_url}"
|
||||
DEPTH "${depth}"
|
||||
PARENT_REPO_BASE_GIT_PATH "${qt5_repo_name}"
|
||||
PROCESS_SUBMODULES_FROM_COMMAND_LINE
|
||||
WORKING_DIRECTORY "${working_directory}"
|
||||
|
||||
@@ -16,6 +16,7 @@ macro(qt_ir_set_known_command_line_options)
|
||||
qt_ir_commandline_option(codereview-username TYPE string)
|
||||
qt_ir_commandline_option(codereview-https TYPE boolean)
|
||||
qt_ir_commandline_option(copy-objects TYPE boolean)
|
||||
qt_ir_commandline_option(depth TYPE string)
|
||||
qt_ir_commandline_option(fetch TYPE boolean DEFAULT_VALUE yes)
|
||||
qt_ir_commandline_option(force SHORT_NAME f TYPE boolean)
|
||||
qt_ir_commandline_option(force-hooks TYPE boolean)
|
||||
|
||||
Reference in New Issue
Block a user