* [BUG] Changing remote URL of "deinited" submodule not taken into account
@ 2024-11-30 7:48 Nicolás Ojeda Bär
2024-11-30 9:59 ` Kristoffer Haugsbakk
0 siblings, 1 reply; 3+ messages in thread
From: Nicolás Ojeda Bär @ 2024-11-30 7:48 UTC (permalink / raw)
To: git
Recently I came across an issue involving Git submodules which seems
like a bug to me.
In short (precise reproduction instructions below), if one updates the
remote URL of a submodule while it is "deinited", the next time one
calls "git update" the old URL will be used instead of the new one.
Here is how to reproduce the issue synthetically (in a fresh directory):
git init
git submodule add https://github.com/git/git-reference sub # random repo
git commit -m "add submodule"
git submodule deinit sub
git submodule init
At this point, the remote URL of the submodule has been copied to
.git/config. We change it:
git config submodule.sub.url "new-url"
Now we checkout the submodule. I am expecting to use "new-url" as
remote URL in the checkout.
git submodule update sub
However, the old URL is used:
git -C sub config remote.origin.url # => old URL instead of "new-url"
The problem seems to be that the clone at .git/modules/sub does not
have its remote URL updated when being "inited" after a remote URL
change while it was "deinited".
Currently I am working around this issue in scripts by doing:
if [ -f .git/modules/$sm_name/config ]
then
git config -f .git/modules/$sm_name/config remote.origin.url $(git
config submodule.$sm_name.url)
fi
Any insight would be appreciated. Thanks!
Cheers,
Nicolas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] Changing remote URL of "deinited" submodule not taken into account
2024-11-30 7:48 [BUG] Changing remote URL of "deinited" submodule not taken into account Nicolás Ojeda Bär
@ 2024-11-30 9:59 ` Kristoffer Haugsbakk
2024-11-30 10:10 ` Nicolás Ojeda Bär
0 siblings, 1 reply; 3+ messages in thread
From: Kristoffer Haugsbakk @ 2024-11-30 9:59 UTC (permalink / raw)
To: Nicolás Ojeda Bär, git
Hi Nicolás
On Sat, Nov 30, 2024, at 08:48, Nicolás Ojeda Bär wrote:
> Recently I came across an issue involving Git submodules which seems
> like a bug to me.
>
> In short (precise reproduction instructions below), if one updates the
> remote URL of a submodule while it is "deinited", the next time one
> calls "git update" the old URL will be used instead of the new one.
What’s your Git version? You can run `git bugreport` to let Git record a file
about your Git and system information. Then you can post it inline here.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] Changing remote URL of "deinited" submodule not taken into account
2024-11-30 9:59 ` Kristoffer Haugsbakk
@ 2024-11-30 10:10 ` Nicolás Ojeda Bär
0 siblings, 0 replies; 3+ messages in thread
From: Nicolás Ojeda Bär @ 2024-11-30 10:10 UTC (permalink / raw)
To: Kristoffer Haugsbakk; +Cc: git
On Sat, Nov 30, 2024 at 11:00 AM Kristoffer Haugsbakk
<kristofferhaugsbakk@fastmail.com> wrote:
>
> What’s your Git version? You can run `git bugreport` to let Git record a file
> about your Git and system information. Then you can post it inline here.
Hello, thanks for your reply. Below are two versions where I am able
to reproduce the issue:
[System Info]
git version:
git version 2.46.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
libcurl: 7.68.0
zlib: 1.2.11
uname: Linux 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5
00:21:55 UTC 2024 x86_64
compiler info: gnuc: 9.4
libc info: glibc: 2.31
$SHELL (typically, interactive shell): /bin/bash
[System Info]
git version:
git version 2.47.0.windows.2
cpu: x86_64
built from commit: 1f8a83cba6e88fad4b881885e64cfb89458e3653
sizeof-long: 4
sizeof-size_t: 8
shell-path: D:/git-sdk-64-build-installers/usr/bin/sh
feature: fsmonitor--daemon
libcurl: 8.10.1
OpenSSL: OpenSSL 3.2.3 3 Sep 2024
zlib: 1.3.1
uname: Windows 10.0 26100
compiler info: gnuc: 14.2
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/bash
Thanks!
Cheers,
Nicolas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-30 10:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-30 7:48 [BUG] Changing remote URL of "deinited" submodule not taken into account Nicolás Ojeda Bär
2024-11-30 9:59 ` Kristoffer Haugsbakk
2024-11-30 10:10 ` Nicolás Ojeda Bär
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).