summaryrefslogtreecommitdiff
path: root/builtin-remote.c
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2008-09-22 08:57:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-09-22 16:29:37 (GMT)
commit7d20e2189e19f51662353ea853891e00882d29cc (patch)
tree19faf53288e515322eb254b38f4846aaea9fa9a3 /builtin-remote.c
parent1f5a892e5209be329dda316edb0341066d62e3eb (diff)
downloadgit-7d20e2189e19f51662353ea853891e00882d29cc.zip
git-7d20e2189e19f51662353ea853891e00882d29cc.tar.gz
git-7d20e2189e19f51662353ea853891e00882d29cc.tar.bz2
make "git remote" report multiple URLs
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. Without "-v" each repo is shown once only. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-remote.c')
-rw-r--r--builtin-remote.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/builtin-remote.c b/builtin-remote.c
index 01945a8..1e2edc2 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;
}
@@ -671,10 +674,14 @@ static int show_all(void)
sort_string_list(&list);
for (i = 0; i < list.nr; i++) {
struct string_list_item *item = list.items + i;
- printf("%s%s%s\n", item->string,
- verbose ? "\t" : "",
- verbose && item->util ?
- (const char *)item->util : "");
+ if (verbose)
+ printf("%s\t%s\n", item->string,
+ item->util ? (const char *)item->util : "");
+ else {
+ if (i && !strcmp((item - 1)->string, item->string))
+ continue;
+ printf("%s\n", item->string);
+ }
}
}
return result;