summaryrefslogtreecommitdiff
path: root/builtin-remote.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-09-29 09:39:53 -0700
committerShawn O. Pearce <spearce@spearce.org>2008-09-29 09:39:53 -0700
commite9a06f1eeb6ddd952ece71eaa87e613d715eade6 (patch)
tree1980b8908177128ed4723da10a051b10e5595f13 /builtin-remote.c
parentcbce6c0be30cbaf8c39051f85006d679338a8ddc (diff)
parent7d20e2189e19f51662353ea853891e00882d29cc (diff)
downloadgit-e9a06f1eeb6ddd952ece71eaa87e613d715eade6.tar.gz
Merge branch 'mg/maint-remote-fix' into maint
* mg/maint-remote-fix: make "git remote" report multiple URLs
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 4cb763f989..90a4e35828 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -650,10 +650,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;
}
@@ -669,10 +672,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;