The argument "--recurse-submodules=no" when doing "fetch --all" is not passed to the following commands which can ends up fetching submodules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux