Make sure the cloned repo's remote is named origin
In the modified script you can see pacman relies
on the remote to be named origin
. Since git v2.30.0
however it's possible to set the global config
"clone.defaultRemoteName" to a custom remote name.
Obviously, doing so will break pacman.
That's why we need to make sure git clone
always sets the remote name to origin
.
-c clone.defaultRemoteName=...
is available since git v2.30.0 (28th Dec 2020)
- https://github.com/git/git/commit/de9ed3ef3740f8227cc924e845032954d1f1b1b7
- https://github.com/git/git/blob/c03801e19cb8ab36e9c0d17ff3d5e0c3b0f24193/Documentation/RelNotes/2.30.0.txt#L30-L32
- https://github.com/git/git/releases/tag/v2.30.0
You might think why use -c clone.defaultRemoteName=...
and not -o ...
? That's because -o
is not allowed together with --bare
(which is implied when using --mirror
). This is strange and makes no sense, that's why upcoming (not yet released) git v2.38.2 will lift this restriction:
- https://github.com/git/git/blob/c03801e19cb8ab36e9c0d17ff3d5e0c3b0f24193/Documentation/RelNotes/2.38.2.txt#L20-L21
- https://github.com/git/git/commit/0d5d92906a8c18d55174531312587baf1dc1d2b5
To not wait for that git v2.38.2 release and until people upgraded to it, I think it's reasonable to just use the -c ...
config for now, it's equivalent anyway and setting it on the command line will overrule any global settings (precedence are listed in the git message here)
I would love to see that fix also backported to the 6.0.x branch, would that be possible?
Thank you very much!