* [PATCH v2] Documentation: clarify multiple pushurls vs urls
@ 2023-02-07 18:12 Calvin Wan
0 siblings, 0 replies; only message in thread
From: Calvin Wan @ 2023-02-07 18:12 UTC (permalink / raw)
To: git; +Cc: avarab, Calvin Wan
In a remote with multiple configured URLs, `git remote -v` shows the
correct url that fetch uses. However, `git config remote.<remote>.url`
returns the last defined url instead. This discrepancy can cause
confusion for users with a remote defined as such, since any url
defined after the first essentially acts as a pushurl.
Add documentation to clarify how fetch interacts with multiple urls
and how push interacts with multiple pushurls and urls.
Add test affirming interaction between fetch and multiple urls.
Signed-off-by: Calvin Wan <calvinwan@google.com>
---
Documentation/urls-remotes.txt | 4 +++-
t/t5510-fetch.sh | 8 ++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/Documentation/urls-remotes.txt b/Documentation/urls-remotes.txt
index 86d0008f94..e410912fe5 100644
--- a/Documentation/urls-remotes.txt
+++ b/Documentation/urls-remotes.txt
@@ -33,7 +33,9 @@ config file would appear like this:
------------
The `<pushurl>` is used for pushes only. It is optional and defaults
-to `<URL>`.
+to `<URL>`. Pushing to a remote affects all defined pushurls or to all
+defined urls if no pushurls are defined. Fetch, however, will only
+fetch from the first defined url if muliple urls are defined.
Named file in `$GIT_DIR/remotes`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index c0b745e33b..34a1261520 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -806,6 +806,14 @@ test_expect_success 'fetch.writeCommitGraph with submodules' '
)
'
+# fetches from first configured url
+test_expect_success 'fetch from multiple configured URLs in single remote' '
+ git init url1 &&
+ git remote add multipleurls url1 &&
+ git remote set-url --add multipleurls url2 &&
+ git fetch multipleurls
+'
+
# configured prune tests
set_config_tristate () {
--
2.39.1.519.gcb327c4b5f-goog
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-07 18:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-07 18:12 [PATCH v2] Documentation: clarify multiple pushurls vs urls Calvin Wan
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).