From: Dominick Latreille <dominick.latreille@ubisoft.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: The argument "--recurse-submodules=no" when doing "fetch --all" is not passed to the following commands which can ends up fetching submodules
Date: Tue, 9 Feb 2021 16:35:58 +0000 [thread overview]
Message-ID: <DM5PR1701MB1724CCBB1AC5CF342BA9ADD5898E9@DM5PR1701MB1724.namprd17.prod.outlook.com> (raw)
Hi!
I opened the following issue https://github.com/git-for-windows/git/issues/3027 , but it also happen when using git on Linux. I have been told to send an email here for the issue.
The git version I am using is the following:
```
git version 2.25.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
```
Terminal used : Bash
Here is the command I ran to trigger this issue
```
GIT_TRACE2=1 git fetch --all --recurse-submodules=no
```
I expected the submodules to not be fetched and to see this command with traces activated
```
git fetch --append --no-auto-gc --recurse-submodules=no --no-write-commit-graph origin
```
But, here is the command line I got with traces activated and the submodules were fetched later on.
```
git fetch --append --no-auto-gc --no-write-commit-graph origin
```
Here are some repro steps with a repository on GitHub.
1. Clone with git bash https://github.com/DomLatr/RepoWithSubmodule
2. In the repo, run the following command : "git submodule update --init"
3. In the file .git\packed-refs, remove the line "f5165dbd5441d97e7fba6b55917a4c7865e5d7ee refs/remotes/origin/change-submodule" to simulate that the repository does not have the branch.
3a. If the line is not present in "packed-refs" or is straight up absent, you can remove the file ".git\refs\remotes\origin\change-submodule", that will have the same result.
4. Run the command : "GIT_TRACE2=1 git fetch --all --recurse-submodules=no"
5. Notice that the submodules **are** fetched since it uses the default value "--recurse-submodules=on-demand" instead of the value passed in the CLI
It happens in a repository with submodules that needs would need to be fetched. The value of "fetch.recurseSubmodules" by default is "on-demand", which translate to "yes" when you need to fetch a new SHA that you don't have locally. I tried the 3 command line possibilities with --recurse-submodules and GIT_TRACE2=1. Here is the following results:
GIT_TRACE2=1 git fetch --all --recurse-submodules=no
=> git fetch --append --no-auto-gc --no-write-commit-graph origin
GIT_TRACE2=1 git fetch --all --recurse-submodules=on-demand
=> git fetch --append --no-auto-gc --no-write-commit-graph --recurse-submodules=on-demand origin
GIT_TRACE2=1 git fetch --all --recurse-submodules=yes
=> git fetch --append --no-auto-gc --no-write-commit-graph --recurse-submodules origin
Since the "--recurse-submodules=no" is not passed to the following commands that are ran automatically, I can see that it is using the default value of "--recuse-submodules=on-demand", which will end up fetching the submodules in this case.
Thanks!
Dominick
next reply other threads:[~2021-02-09 16:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-09 16:35 Dominick Latreille [this message]
2021-02-09 17:00 ` The argument "--recurse-submodules=no" when doing "fetch --all" is not passed to the following commands which can ends up fetching submodules Jeff King
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM5PR1701MB1724CCBB1AC5CF342BA9ADD5898E9@DM5PR1701MB1724.namprd17.prod.outlook.com \
--to=dominick.latreille@ubisoft.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.
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 NNTP newsgroup(s).