* Submodule update fetching with outer repo's default branch
@ 2023-08-28 23:57 Scott Shawcroft
2023-11-28 18:32 ` Ricardo Abreu
0 siblings, 1 reply; 2+ messages in thread
From: Scott Shawcroft @ 2023-08-28 23:57 UTC (permalink / raw)
To: git
Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.
What did you do before the bug happened? (Steps to reproduce your issue)
I have a repo (https://github.com/adafruit/circuitpython) with a large number
of submodules. When switching branches we have a `make fetch-all-submodules`
command that runs `git submodule update --init` under the hood.
What did you expect to happen? (Expected behavior)
The data/nvm.toml submodule should update to the commit set by the state of the outer repo.
What happened instead? (Actual behavior)
env GIT_TRACE=1 git submodule update --init data/nvm.toml/
16:33:38.062849 git.c:749 trace: exec: git-submodule update --init data/nvm.toml/
16:33:38.062882 run-command.c:659 trace: run_command: git-submodule update --init data/nvm.toml/
16:33:38.077269 git.c:463 trace: built-in: git rev-parse --git-dir
16:33:38.079447 git.c:463 trace: built-in: git rev-parse --git-path objects
16:33:38.083204 git.c:463 trace: built-in: git rev-parse --show-prefix
16:33:38.085057 git.c:463 trace: built-in: git rev-parse --show-toplevel
16:33:38.089671 git.c:463 trace: built-in: git submodule--helper update --init -- data/nvm.toml/
16:33:38.091052 run-command.c:1523 run_processes_parallel: preparing to run up to 1 tasks
16:33:38.091061 run-command.c:1551 run_processes_parallel: done
16:33:38.091934 run-command.c:659 trace: run_command: cd data/nvm.toml; unset GIT_PREFIX; GIT_DIR=.git git rev-list -n 1 427cc923976229bcb981ca6f218ebe8efd636df6 --not --all
16:33:38.093709 run-command.c:659 trace: run_command: cd data/nvm.toml; unset GIT_PREFIX; GIT_DIR=.git git fetch
16:33:38.094641 git.c:463 trace: built-in: git fetch
16:33:38.094933 run-command.c:659 trace: run_command: git remote-https origin https://github.com/adafruit/nvm.toml.git
16:33:38.095835 git.c:749 trace: exec: git-remote-https origin https://github.com/adafruit/nvm.toml.git
16:33:38.095861 run-command.c:659 trace: run_command: git-remote-https origin https://github.com/adafruit/nvm.toml.git
16:33:38.352385 run-command.c:1523 run_processes_parallel: preparing to run up to 1 tasks
16:33:38.352401 run-command.c:1551 run_processes_parallel: done
16:33:38.352407 run-command.c:659 trace: run_command: git maintenance run --auto --no-quiet
16:33:38.353616 git.c:463 trace: built-in: git maintenance run --auto --no-quiet
16:33:38.354265 run-command.c:659 trace: run_command: cd data/nvm.toml; unset GIT_PREFIX; GIT_DIR=.git git rev-list -n 1 427cc923976229bcb981ca6f218ebe8efd636df6 --not --all
16:33:38.356060 run-command.c:659 trace: run_command: cd data/nvm.toml; unset GIT_PREFIX; GIT_DIR=.git git fetch adafruit321 427cc923976229bcb981ca6f218ebe8efd636df6
16:33:38.357177 git.c:463 trace: built-in: git fetch adafruit321 427cc923976229bcb981ca6f218ebe8efd636df6
fatal: transport 'file' not allowed
fatal: Fetched in submodule path 'data/nvm.toml', but it did not contain 427cc923976229bcb981ca6f218ebe8efd636df6. Direct fetching of that commit failed.
What's different between what you expected and what actually happened?
The submodule update is unable to find the target commit even though it is present in the submodule's repo.
Anything else you want to add:
Looking at the trace I noticed it's doing `git fetch adafruit321 ...` instead of the correct `git fetch origin ...`. (The `git remote-https origin` command is correct.) adafruit321 is the default branch in `.git/config` for my outer repo's branch (not the submodule). It looks like `fetch_in_submodules` is using the wrong default branch: https://github.com/git/git/blob/next/builtin/submodule--helper.c#L2241C31-L2241C31
Please review the rest of the bug report below.
You can delete any lines you don't wish to share.
[System Info]
git version:
git version 2.42.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.4.12-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 24 Aug 2023 00:38:14 +0000 x86_64
compiler info: gnuc: 13.2
libc info: glibc: 2.38
$SHELL (typically, interactive shell): /usr/bin/fish
[Enabled Hooks]
pre-commit
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Submodule update fetching with outer repo's default branch
2023-08-28 23:57 Submodule update fetching with outer repo's default branch Scott Shawcroft
@ 2023-11-28 18:32 ` Ricardo Abreu
0 siblings, 0 replies; 2+ messages in thread
From: Ricardo Abreu @ 2023-11-28 18:32 UTC (permalink / raw)
To: scott; +Cc: git
I have the same problem. Here is a generic recipe to reproduce, assuming a repository X with a submodule Y (set with an `https` URL):
1. `git clone ... X`
2. `cd X`
3. `git submodule sync`
4. `git submodule update --init --recursive`
5. `git remote rename origin remotex` # rename the remote in X, not Y
6. Elsewhere, add a new commit to Y and create a branch "update-y" in X, pointing the submodule to that commit. Suppose the hash of the new commit in Y is `abc1abc`.
7. `git fetch remotex`
8. `git checkout update-y`
9. `git submodule sync`
10. `GIT_TRACE=1 git submodule update --init --recursive`
- observe:
* the command in the last trace message to be `git fetch remotex abc1abc` (should be `git fetch origin abc1abc`, because that is still the name of the submodule's remote)
* the wrong error message complaining about 'file' protocol (which isn't involved anywhere)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-28 18:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-28 23:57 Submodule update fetching with outer repo's default branch Scott Shawcroft
2023-11-28 18:32 ` Ricardo Abreu
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).