git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Tadeus Prastowo <tadeus.prastowo@praim.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: [Bug] Behavioral change in git clone --depth=1 --recurse-submodule
Date: Thu, 15 Sep 2022 12:23:08 +0000	[thread overview]
Message-ID: <VI1PR02MB6301891F2C862773918CB659FD499@VI1PR02MB6301.eurprd02.prod.outlook.com> (raw)

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

                 reply	other threads:[~2022-09-15 12:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR02MB6301891F2C862773918CB659FD499@VI1PR02MB6301.eurprd02.prod.outlook.com \
    --to=tadeus.prastowo@praim.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).