Re: [PATCHv2 5/6] submodule update: add super-reference flag
From: Junio C Hamano <hidden>
Date: 2016-08-06 20:10:21
Stefan Beller [off-list ref] writes:
When we have a another clone of a superproject, we may want to mirror the submodules using alternates. Introduce an option `--super-reference` that let's a user point to another superproject, which is assumed to have the same structure as the one they are running the "submodule update" command from and has all submodules checked out to borrow the submodule objects from within the other superprojects git directory.
That's much better than the previous round. I however have trouble with the "checked out", though. Isn't it that it merely has to be "init"ed? For that matter, as long as super.git has $GIT_DIR/modules/ populated fully, it does not matter it has checkout, and more interestingly and importantly, the superproject mirror can even be a bare repository!
+--super-reference <superproject repository>:: + This option is only valid for the update command. When update needs + to clone a repository, a reference will be passed to the clone command + that points at the submodule path inside the reference superproject.
"points at the submodule path inside" sounds as if we would look at
/var/cache/super/libs/xyzzy
in the scenario in [ref],
when you give us "--super-reference=/var/cache/super". Can we
clarify to avoid such a misread?
+superreference=
Please don't name a multiple_word field "multipleword".
quoted hunk
cached= recursive= init=@@ -520,6 +521,14 @@ cmd_update() --reference=*) reference="$1" ;; + --super-reference) + case "$2" in '') usage ;; esac + superreference="--super-reference=$2" + shift + ;; + --super-reference=*) + superreference="$1" + ;; -m|--merge) update="merge" ;;@@ -576,6 +585,7 @@ cmd_update() ${prefix:+--recursive-prefix "$prefix"} \ ${update:+--update "$update"} \ ${reference:+"$reference"} \ + ${superreference:+"$superreference"} \ ${depth:+--depth "$depth"} \ ${recommend_shallow:+"$recommend_shallow"} \ ${jobs:+$jobs} \