1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2026-03-02 03:49:29 +00:00

Add support and tests for clone --recurse-submodules

Including tests for clone --recursive.
This commit is contained in:
Erik Flodin
2025-01-19 23:13:37 +01:00
parent a86f2381b6
commit 02b4019bc6
3 changed files with 70 additions and 11 deletions

15
yadm
View File

@@ -754,7 +754,7 @@ function clone() {
DO_BOOTSTRAP=1
local -a args
local -i do_checkout=1
local -i do_submodules=0
local -a submodules
while [[ $# -gt 0 ]]; do
case "$1" in
--bootstrap) # force bootstrap, without prompt
@@ -769,10 +769,13 @@ function clone() {
-n | --no-checkout)
do_checkout=0
;;
--recursive)
do_submodules=1
--recursive | --recurse-submodules)
submodules+=(":/")
;;
--bare | --mirror | --recurse-submodules* | --separate-git-dir=*)
--recurse-submodules=*)
submodules+=(":/${1#*=}")
;;
--bare | --mirror | --separate-git-dir=*)
# ignore arguments without separate parameter
;;
--separate-git-dir)
@@ -839,8 +842,8 @@ function clone() {
"$GIT_PROGRAM" checkout -- ":/$file"
done
if [[ $do_submodules -ne 0 ]]; then
"$GIT_PROGRAM" submodule update --init --recursive
if [ ${#submodules[@]} -gt 0 ]; then
"$GIT_PROGRAM" submodule update --init --recursive -- "${submodules[@]}"
fi
if [ -n "$("$GIT_PROGRAM" ls-files --modified)" ]; then