Skip to content

Commit e9a06f1

Browse files
committed
Merge branch 'mg/maint-remote-fix' into maint
* mg/maint-remote-fix: make "git remote" report multiple URLs
2 parents cbce6c0 + 7d20e21 commit e9a06f1

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

builtin-remote.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,13 @@ static int get_one_entry(struct remote *remote, void *priv)
650650
{
651651
struct string_list *list = priv;
652652

653-
string_list_append(remote->name, list)->util = remote->url_nr ?
654-
(void *)remote->url[0] : NULL;
655-
if (remote->url_nr > 1)
656-
warning("Remote %s has more than one URL", remote->name);
653+
if (remote->url_nr > 0) {
654+
int i;
655+
656+
for (i = 0; i < remote->url_nr; i++)
657+
string_list_append(remote->name, list)->util = (void *)remote->url[i];
658+
} else
659+
string_list_append(remote->name, list)->util = NULL;
657660

658661
return 0;
659662
}
@@ -669,10 +672,14 @@ static int show_all(void)
669672
sort_string_list(&list);
670673
for (i = 0; i < list.nr; i++) {
671674
struct string_list_item *item = list.items + i;
672-
printf("%s%s%s\n", item->string,
673-
verbose ? "\t" : "",
674-
verbose && item->util ?
675-
(const char *)item->util : "");
675+
if (verbose)
676+
printf("%s\t%s\n", item->string,
677+
item->util ? (const char *)item->util : "");
678+
else {
679+
if (i && !strcmp((item - 1)->string, item->string))
680+
continue;
681+
printf("%s\n", item->string);
682+
}
676683
}
677684
}
678685
return result;

0 commit comments

Comments
 (0)