{"thread":{"id":"15570","subject":"Re: git equivalent to svn info?","startedAt":"2008-09-18T05:50:51Z","lastAt":"2008-09-22T08:57:51Z","messageCount":4,"participants":["Junio C Hamano","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"90988","messageId":"7v4p4e0zpg.fsf@gitster.siamese.dyndns.org","threadId":"15570","inReplyTo":"20080917224856.GT10360@machine.or.cz","subject":"Re: git equivalent to svn info?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-18T05:50:51Z","receivedAt":"2008-09-18T05:50:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky-+ZI9xUNit7I@public.gmane.org> writes:\n\n> On Thu, Sep 18, 2008 at 10:13:34AM +1200, Francois Marier wrote:\n>> On Wed, 2008-09-17 at 14:46 -0700, skillzero-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:\n>> > Is there an easy way with git to get the URL of the repository that\n>> > you cloned from, similar to what svn info shows for a subversion\n>> > repository? I see it's stored in [remote \"origin\"]->url section of\n>> > the .git/config, but I was hoping for an easy-to-remember command to\n>> > display it.\n>> \n>> I normally use \"git remote show origin\"\n>\n> You can also get a quick overview with git remote -v.\n\nAh, that reminds me...\n\nIt is Ok to have more than one URL defined for a remote if you use that\nremote for push, but \"git remote -v\" complains, like this:\n\n    $ git remote -v\n    warning: Remote builders has more than one URL\n    builders        box-fc5:git/\n    ko-private\tm.kernel.org:git/\n\nwhen I have 3 URLs (box-fc5, box-fc7 and box-fc9) for \"builders\" remote to\npush into.\n\nCould somebody fix this, please?\n"},{"id":"91039","messageId":"1221754262-15772-1-git-send-email-git@drmicha.warpmail.net","threadId":"15570","inReplyTo":"7v4p4e0zpg.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] make \"git remote\" report multiple URLs","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2008-09-18T16:11:02Z","receivedAt":"2008-09-18T16:11:02Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"This patch makes \"git remote -v\" and \"git remote show\" report multiple URLs\nrather than warn about them. Multiple URLs are OK for pushing into\nmultiple repos simultaneously.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n builtin-remote.c |   11 +++++++----\n 1 files changed, 7 insertions(+), 4 deletions(-)\n\nThis passes all tests, so I think the new output does not break anything.\n\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex 01945a8..ae560e7 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -652,10 +652,13 @@ static int get_one_entry(struct remote *remote, void *priv)\n {\n \tstruct string_list *list = priv;\n \n-\tstring_list_append(remote->name, list)->util = remote->url_nr ?\n-\t\t(void *)remote->url[0] : NULL;\n-\tif (remote->url_nr > 1)\n-\t\twarning(\"Remote %s has more than one URL\", remote->name);\n+\tif (remote->url_nr > 0) {\n+\t\tint i;\n+\n+\t\tfor (i = 0; i < remote->url_nr; i++)\n+\t\t\tstring_list_append(remote->name, list)->util = (void *)remote->url[i];\n+\t} else\n+\t\tstring_list_append(remote->name, list)->util = NULL;\n \n \treturn 0;\n }\n-- \n1.6.0.2.249.g97d7f\n"},{"id":"91142","messageId":"7vej3fswwe.fsf@gitster.siamese.dyndns.org","threadId":"15570","inReplyTo":"1221754262-15772-1-git-send-email-git@drmicha.warpmail.net","subject":"Re: [PATCH] make \"git remote\" report multiple URLs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-19T20:28:33Z","receivedAt":"2008-09-19T20:28:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> This patch makes \"git remote -v\" and \"git remote show\" report multiple URLs\n> rather than warn about them. Multiple URLs are OK for pushing into\n> multiple repos simultaneously.\n>\n> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n> ---\n\nNice.  But this makes \"git remote show\" to give duplicate results, which\nyou might want to cull.\n\n>  builtin-remote.c |   11 +++++++----\n>  1 files changed, 7 insertions(+), 4 deletions(-)\n>\n> This passes all tests, so I think the new output does not break anything.\n\nOr just there is no existing tests that verify the output from this command.\n\n> diff --git a/builtin-remote.c b/builtin-remote.c\n> index 01945a8..ae560e7 100644\n> --- a/builtin-remote.c\n> +++ b/builtin-remote.c\n> @@ -652,10 +652,13 @@ static int get_one_entry(struct remote *remote, void *priv)\n>  {\n>  \tstruct string_list *list = priv;\n>  \n> -\tstring_list_append(remote->name, list)->util = remote->url_nr ?\n> -\t\t(void *)remote->url[0] : NULL;\n> -\tif (remote->url_nr > 1)\n> -\t\twarning(\"Remote %s has more than one URL\", remote->name);\n> +\tif (remote->url_nr > 0) {\n> +\t\tint i;\n> +\n> +\t\tfor (i = 0; i < remote->url_nr; i++)\n> +\t\t\tstring_list_append(remote->name, list)->util = (void *)remote->url[i];\n> +\t} else\n> +\t\tstring_list_append(remote->name, list)->util = NULL;\n>  \n>  \treturn 0;\n>  }\n> -- \n> 1.6.0.2.249.g97d7f\n"},{"id":"91291","messageId":"1222073871-495-1-git-send-email-git@drmicha.warpmail.net","threadId":"15570","inReplyTo":"7vej3fswwe.fsf@gitster.siamese.dyndns.org","subject":"[PATCH v2] make \"git remote\" report multiple URLs","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2008-09-22T08:57:51Z","receivedAt":"2008-09-22T08:57:51Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"This patch makes \"git remote -v\" and \"git remote show\" report multiple URLs\nrather than warn about them. Multiple URLs are OK for pushing into\nmultiple repos simultaneously. Without \"-v\" each repo is shown once only.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n builtin-remote.c |   23 +++++++++++++++--------\n 1 files changed, 15 insertions(+), 8 deletions(-)\n\nChange in v2: report each repo once only if \"-v\" is not used (i.e. URL is not shown),\nas requested by JC.\n\nJC wrote:\n> MJG wrote:\n>> This passes all tests, so I think the new output does not break anything.\n\n> Or just there is no existing tests that verify the output from this command.\n\nJC, sounds as if you're a mathematician, as well ;)\n\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex 01945a8..1e2edc2 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -652,10 +652,13 @@ static int get_one_entry(struct remote *remote, void *priv)\n {\n \tstruct string_list *list = priv;\n \n-\tstring_list_append(remote->name, list)->util = remote->url_nr ?\n-\t\t(void *)remote->url[0] : NULL;\n-\tif (remote->url_nr > 1)\n-\t\twarning(\"Remote %s has more than one URL\", remote->name);\n+\tif (remote->url_nr > 0) {\n+\t\tint i;\n+\n+\t\tfor (i = 0; i < remote->url_nr; i++)\n+\t\t\tstring_list_append(remote->name, list)->util = (void *)remote->url[i];\n+\t} else\n+\t\tstring_list_append(remote->name, list)->util = NULL;\n \n \treturn 0;\n }\n@@ -671,10 +674,14 @@ static int show_all(void)\n \t\tsort_string_list(&list);\n \t\tfor (i = 0; i < list.nr; i++) {\n \t\t\tstruct string_list_item *item = list.items + i;\n-\t\t\tprintf(\"%s%s%s\\n\", item->string,\n-\t\t\t\tverbose ? \"\\t\" : \"\",\n-\t\t\t\tverbose && item->util ?\n-\t\t\t\t\t(const char *)item->util : \"\");\n+\t\t\tif (verbose)\n+\t\t\t\tprintf(\"%s\\t%s\\n\", item->string,\n+\t\t\t\t\titem->util ? (const char *)item->util : \"\");\n+\t\t\telse {\n+\t\t\t\tif (i && !strcmp((item - 1)->string, item->string))\n+\t\t\t\t\tcontinue;\n+\t\t\t\tprintf(\"%s\\n\", item->string);\n+\t\t\t}\n \t\t}\n \t}\n \treturn result;\n-- \n1.6.0.2.287.g3791f\n"}]}