From: Tadeus Prastowo Date: Thu, 15 Sep 2022 12:23:08 GMT Subject: [Bug] Behavioral change in git clone --depth=1 --recurse-submodule Message-ID: 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= -b ssh://@/ Cloning into ''... remote: Counting objects: , done. remote: Compressing objects: 100% (/), done. remote: Total (delta ), reused (delta ) Receiving objects: 100% (/), MiB | MiB/s, done. Resolving deltas: 100% (/), done. Updating files: 100% (/), done. Submodule '' (ssh://@/) registered for path '' Cloning into ''... remote: Counting objects: , done. remote: Compressing objects: 100% (/), done. remote: Total (delta ), reused (delta ) Receiving objects: 100% (/), MiB | MiB/s, done. Resolving deltas: 100% (/), done. Submodule path '': checked out '' 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= -b ssh://@/ Cloning into ''... remote: Counting objects: , done. remote: Compressing objects: 100% (/), done. remote: Total (delta ), reused (delta ) Receiving objects: 100% (/), MiB | MiB/s, done. Resolving deltas: 100% (/), done. Updating files: 100% (/), done. Submodule '' (ssh://@/) registered for path '' Cloning into ''... remote: Counting objects: , done. remote: Compressing objects: 100% (/), done. remote: Total (delta ), reused (delta ) Receiving objects: 100% (/), MiB | MiB/s, done. Resolving deltas: 100% (/), done. error: Server does not allow request for unadvertised object fatal: Fetched in submodule path '', but it did not contain . Direct fetching of that commit failed. [Analysis of the Problem] I can see that the number is also reported when running (regardless of the git version): git clone --verbose --recurse-submodules ssh://@/ And, I can see that the number is also reported when running (regardless of the git version): git clone --verbose --recurse-submodules --single-branch -b master ssh://@/ 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 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 " 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