git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG] Possible bug in `remote set-url --add --push`

From
Jardel Weyrich <jweyrich@gmail.com>
Date
Jan 12, 2013, 05:44 UTC
Message-ID
<CAN8TAOsnX1Mr72LPa47KKXDeUZPgSHTJ6u4YpPFPrtsK7VdN+A@mail.gmail.com>
Hi,

I believe `remote set-url --add --push` has a bug. Performed tests with v1.8.0.1 and v1.8.1 (Mac OS X).

Quoting the relevant part of the documentation:
Show 6 quoted lines
> set-url
>     Changes URL remote points to. Sets first URL remote points to matching regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If <oldurl> doesn’t match any URL, error occurs and nothing is changed.
>
>     With --push, push URLs are manipulated instead of fetch URLs.
>     With --add, instead of changing some URL, new URL is added.
>     With --delete, instead of changing some URL, all URLs matching regex <url> are deleted. Trying to delete all non-push URLs is an error.
Here are some steps to reproduce:
1. Show the remote URLs

jweyrich@pharao:test_clone1 [* master]$ git remote -v origin /Volumes/sandbox/test (fetch) origin /Volumes/sandbox/test (push)

2. Add a new push URL for origin
jweyrich@pharao:test_clone1 [* master]$ git remote set-url --add --push origin \
    /Volumes/sandbox/test_clone2
3. Check what happened

jweyrich@pharao:test_clone1 [* master]$ git remote -v origin /Volumes/sandbox/test (fetch) origin /Volumes/sandbox/test_clone2 (push)

4. Missing an URL? Re-add the original one
jweyrich@pharao:test_clone1 [* master]$ git remote set-url --add --push origin \
    /Volumes/sandbox/test
5. Check what happened, again

jweyrich@pharao:test_clone1 [* master]$ git remote -v origin /Volumes/sandbox/test (fetch) origin /Volumes/sandbox/test_clone2 (push) origin /Volumes/sandbox/test (push)

In step 2, Git replaced the original push URL instead of adding a new one. But it seems to happen only the first time I use `remote set-url --add --push`. Re-adding the original URL using the same command seems to work properly. And FWIW, if I delete (with "set-url --delete") both URLs push, Git restores the original URL.

Please, could someone try to reproduce?
- jw
Next: Junio C Hamano
Message 1 of 27 in “[BUG] Possible bug in `remote set-url --add --push`”
  1. Jardel WeyrichJan 12, 2013
  2. Junio C HamanoJan 12, 2013
  3. Jardel WeyrichJan 12, 2013
  4. Junio C HamanoJan 12, 2013
  5. Sascha CunzJan 12, 2013
  6. Jardel WeyrichJan 12, 2013
  7. Michael J GruberJan 14, 2013
  8. Jonathan NiederJan 14, 2013
  9. Junio C HamanoJan 14, 2013
  10. Jardel WeyrichJan 15, 2013
  11. Junio C HamanoJan 15, 2013
  12. Junio C HamanoJan 15, 2013
  13. Michael J GruberJan 15, 2013
  14. Junio C HamanoJan 15, 2013
  15. Michael J GruberJan 16, 2013
  16. Junio C HamanoJan 16, 2013
  17. Michael J GruberJan 16, 2013
  18. Andreas SchwabJan 16, 2013
  19. Junio C HamanoJan 16, 2013
  20. git-remote: distinguish between default and configured URLsMichael J Gruber, Jan 16, 2013
  21. Michael J GruberJan 16, 2013
  22. John KeepingJan 16, 2013
  23. Michael J GruberJan 16, 2013
  24. John KeepingJan 16, 2013
  25. Junio C HamanoJan 16, 2013
  26. Phil HordJan 16, 2013
  27. Michael J GruberJan 16, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.