File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,11 @@ git checkout -f
8080{{ zip_locator_text }}
8181
8282# Input datasets: ``datalad clone --no-checkout``, sparse paths, ``git checkout -f``.
83+ #
84+ # ensure_input_submodule: if $1 is nonempty and not already a Git repo, clone it as a
85+ # DataLad subdataset using .gitmodules (prefer datalad-url, else url). Plain absolute
86+ # paths are converted to file:// URLs. Uses --no-checkout. No-op if already present;
87+ # exits if no URL is configured.
8388ensure_input_submodule() {
8489 local mount="$1"
8590 [ -n "${mount}" ] || return 0
@@ -91,13 +96,20 @@ ensure_input_submodule() {
9196 || src="$(git config -f .gitmodules --get "submodule.${mount}.url" 2>/dev/null)" \
9297 || src=""
9398 if [ -n "${src}" ]; then
99+ case "${src}" in
100+ /*) src="file://${src}" ;;
101+ esac
94102 datalad clone -d . "${src}" "${mount}" -- --no-checkout
95103 else
96104 echo "ERROR: no submodule URL in .gitmodules for ${mount}" 1>&2
97105 exit 1
98106 fi
99107}
100108
109+ # sparse_checkout_input: if $1 is nonempty and points to a Git repo, enter that repo,
110+ # initialize sparse-checkout in non-cone mode, set the sparse-checkout patterns from the
111+ # remaining arguments (passed one per line to `git sparse-checkout set --stdin`), and then
112+ # force a checkout with `git checkout -f`. No-op if $1 is empty or not a Git repo.
101113sparse_checkout_input() {
102114 local mount="$1"
103115 shift
You can’t perform that action at this time.
0 commit comments