author | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 29 Sep 2008 16:39:53 +0000 (09:39 -0700) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 29 Sep 2008 16:39:53 +0000 (09:39 -0700) |
* mg/maint-remote-fix:
make "git remote" report multiple URLs
make "git remote" report multiple URLs
builtin-remote.c | patch | blob | history |
diff --git a/builtin-remote.c b/builtin-remote.c
index 4cb763f989fc987d94141ed763223cb361cec44a..90a4e35828697f349a38ba3486c40813db32cee0 100644 (file)
--- a/builtin-remote.c
+++ b/builtin-remote.c
{
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;
}
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;