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_clone23. 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/test5. 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