Re: [PATCH] make "git remote" report multiple URLs
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 19, 2008, 20:28 UTC
- Message-ID
- <7vej3fswwe.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <1221754262-15772-1-git-send-email-git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 6 quoted lines
> This patch makes "git remote -v" and "git remote show" report multiple URLs > rather than warn about them. Multiple URLs are OK for pushing into > multiple repos simultaneously. > > Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> > ---
Nice. But this makes "git remote show" to give duplicate results, which you might want to cull.
> builtin-remote.c | 11 +++++++---- > 1 files changed, 7 insertions(+), 4 deletions(-) > > This passes all tests, so I think the new output does not break anything.
Or just there is no existing tests that verify the output from this command.
Show 24 quoted lines
> diff --git a/builtin-remote.c b/builtin-remote.c
> index 01945a8..ae560e7 100644
> --- a/builtin-remote.c
> +++ b/builtin-remote.c
> @@ -652,10 +652,13 @@ static int get_one_entry(struct remote *remote, void *priv)
> {
> struct string_list *list = priv;
>
> - string_list_append(remote->name, list)->util = remote->url_nr ?
> - (void *)remote->url[0] : NULL;
> - if (remote->url_nr > 1)
> - warning("Remote %s has more than one URL", remote->name);
> + if (remote->url_nr > 0) {
> + int i;
> +
> + for (i = 0; i < remote->url_nr; i++)
> + string_list_append(remote->name, list)->util = (void *)remote->url[i];
> + } else
> + string_list_append(remote->name, list)->util = NULL;
>
> return 0;
> }
> --
> 1.6.0.2.249.g97d7f