git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [Bug] Behavioral change in git clone --depth=1 --recurse-submodule
@ 2022-09-15 12:23 Tadeus Prastowo
  0 siblings, 0 replies; only message in thread
From: Tadeus Prastowo @ 2022-09-15 12:23 UTC (permalink / raw)
  To: git@vger.kernel.org

Hello,

First of all, please keep me in CC as I am not subscribed to the mailing list.

Expected result when using Ubuntu Focal 20.04 LTS:

$ git --version
git version 2.25.1
$ git clone --verbose --depth=1 --recurse-submodules=<submodule path> -b <branch name> ssh://<user name>@<server name>/<repo path>
Cloning into '<repo name>'...
remote: Counting objects: <number A>, done.
remote: Compressing objects: 100% (<number B>/<number B>), done.
remote: Total <number A> (delta <number F>), reused <number C> (delta <number D>)
Receiving objects: 100% (<number A>/<number A>), <number U> MiB | <number V> MiB/s, done.
Resolving deltas: 100% (<number F>/<number F>), done.
Updating files: 100% (<number G>/<number G>), done.
Submodule '<submodule path>' (ssh://<user name>@<server name>/<submodule path>) registered for path '<submodule path>'
Cloning into '<submodule absolute path>'...
remote: Counting objects: <IMPORTANT A>, done.
remote: Compressing objects: 100% (<number H>/<number H>), done.
remote: Total <IMPORTANT A> (delta <number I>), reused <number J> (delta <number K>)
Receiving objects: 100% (<IMPORTANT A>/<IMPORTANT A>), <number X> MiB | <number Y> MiB/s, done.
Resolving deltas: 100% (<number I>/<number I>), done.
Submodule path '<submodule path>': checked out '<OID>'

Problem observed when using the same Ubuntu Focal 20.04 LTS machine but using a different working directory:

$ sudo add-apt-repository ppa:git-core/ppa
$ sudo aptitude install git
$ git --version
git version 2.37.3
$ git clone --verbose --depth=1 --recurse-submodules=<submodule path> -b <branch name> ssh://<user name>@<server name>/<repo path>
Cloning into '<repo name>'...
remote: Counting objects: <number A>, done.
remote: Compressing objects: 100% (<number B>/<number B>), done.
remote: Total <number A> (delta <number F>), reused <number C> (delta <number D>)
Receiving objects: 100% (<number A>/<number A>), <number Q> MiB | <number R> MiB/s, done.
Resolving deltas: 100% (<number F>/<number F>), done.
Updating files: 100% (<number G>/<number G>), done.
Submodule '<submodule path>' (ssh://<user name>@<server name>/<submodule path>) registered for path '<submodule path>'
Cloning into '<submodule absolute path>'...
remote: Counting objects: <IMPORTANT B>, done.
remote: Compressing objects: 100% (<number L>/<number L>), done.
remote: Total <IMPORTANT B> (delta <number M>), reused <number N> (delta <number O>)
Receiving objects: 100% (<IMPORTANT B>/<IMPORTANT B>), <number W> MiB | <number Z> MiB/s, done.
Resolving deltas: 100% (<number M>/<number M>), done.
error: Server does not allow request for unadvertised object <OID>
fatal: Fetched in submodule path '<submodule path>', but it did not contain <OID>. Direct fetching of that commit failed.

[Analysis of the Problem]

I can see that the number <IMPORTANT A> is also reported when running (regardless of the git version):
git clone --verbose --recurse-submodules ssh://<user name>@<server name>/<submodule path>

And, I can see that the number <IMPORTANT B> is also reported when running (regardless of the git version):
git clone --verbose --recurse-submodules --single-branch -b master ssh://<user name>@<server name>/<submodule path>

In other words, while git version 2.25.1 respects what the `git-clone' man page says about the option `--recurse-submodules', git version 2.37.3 does not, quoting https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---recurse-submodulesltpathspecgt:

Submodules are initialized and cloned using their default settings. This is equivalent to running git submodule update --init --recursive <pathspec> immediately after the clone is finished.

End quote.

[The Bug]

The option `--recurse-submodules' is no longer equivalent to "running git submodule update --init --recursive <pathspec>" in git version 2.37.3.

Now this report can be regarded as reporting a bug in the documentation, which is correct.

But, it is my desire for this report to be regarded as reporting a bug in git, especially because other people have reported a specific deficiency in git submodule: the branch information given in .gitmodules is not used when git wants to use the option `--single-branch' on a submodule (see https://lore.kernel.org/git/CANNNLMC_XEqjYPOig+pbqrS30dPCTmcDSev6yg+5EEBkJCaaig@mail.gmail.com/ and the StackOverflow answer refered therein https://stackoverflow.com/a/61492323).

In other words, it is my desire to see not only the documentation be fixed but also git submodule to use the branch information specified in .gitmodules when using the option `--single-branch' on a submodule when cloning a repository by specifying the options `--recurse-submodules' and `--depth'.

Thank you.

-- 
Best regards,
Tadeus

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-15 12:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15 12:23 [Bug] Behavioral change in git clone --depth=1 --recurse-submodule Tadeus Prastowo

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).