{"thread":{"id":"59208","subject":"[PATCH v2] Documentation: clarify multiple pushurls vs urls","startedAt":"2023-02-07T18:12:43Z","lastAt":"2023-02-07T18:12:43Z","messageCount":1,"participants":["Calvin Wan"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"471704","messageId":"20230207181227.361290-1-calvinwan@google.com","threadId":"59208","inReplyTo":null,"subject":"[PATCH v2] Documentation: clarify multiple pushurls vs urls","fromName":"Calvin Wan","fromEmail":"calvinwan@google.com","sentAt":"2023-02-07T18:12:27Z","receivedAt":"2023-02-07T18:12:43Z","isPatch":true,"sender":{"key":"calvinwan@google.com","avatar":"https://avatars.githubusercontent.com/u/92547554?v=4"},"body":"In a remote with multiple configured URLs, `git remote -v` shows the\ncorrect url that fetch uses. However, `git config remote.<remote>.url`\nreturns the last defined url instead. This discrepancy can cause\nconfusion for users with a remote defined as such, since any url\ndefined after the first essentially acts as a pushurl.\n\nAdd documentation to clarify how fetch interacts with multiple urls\nand how push interacts with multiple pushurls and urls.\n\nAdd test affirming interaction between fetch and multiple urls.\n\nSigned-off-by: Calvin Wan <calvinwan@google.com>\n---\n Documentation/urls-remotes.txt | 4 +++-\n t/t5510-fetch.sh               | 8 ++++++++\n 2 files changed, 11 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/urls-remotes.txt b/Documentation/urls-remotes.txt\nindex 86d0008f94..e410912fe5 100644\n--- a/Documentation/urls-remotes.txt\n+++ b/Documentation/urls-remotes.txt\n@@ -33,7 +33,9 @@ config file would appear like this:\n ------------\n \n The `<pushurl>` is used for pushes only. It is optional and defaults\n-to `<URL>`.\n+to `<URL>`. Pushing to a remote affects all defined pushurls or to all\n+defined urls if no pushurls are defined. Fetch, however, will only\n+fetch from the first defined url if muliple urls are defined.\n \n Named file in `$GIT_DIR/remotes`\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\ndiff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh\nindex c0b745e33b..34a1261520 100755\n--- a/t/t5510-fetch.sh\n+++ b/t/t5510-fetch.sh\n@@ -806,6 +806,14 @@ test_expect_success 'fetch.writeCommitGraph with submodules' '\n \t)\n '\n \n+# fetches from first configured url\n+test_expect_success 'fetch from multiple configured URLs in single remote' '\n+\tgit init url1 &&\n+\tgit remote add multipleurls url1 &&\n+\tgit remote set-url --add multipleurls url2 &&\n+\tgit fetch multipleurls\n+'\n+\n # configured prune tests\n \n set_config_tristate () {\n-- \n2.39.1.519.gcb327c4b5f-goog\n\n"}]}