Re: [PATCHv2 5/6] submodule update: add super-reference flag
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 6, 2016, 17:13 UTC
- Message-ID
- <xmqqh9axizw9.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160806012318.17968-6-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 7 quoted lines
> 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 <xmqqoa57vvzl.fsf@gitster.mtv.corp.google.com>, 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".
Show 26 quoted lines
> 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} \