diff options
author | Michael J Gruber <git@drmicha.warpmail.net> | 2009-06-13 18:29:10 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-06-13 10:31:33 -0700 |
commit | 857f8c30d79ce15b6110b0df9d3ad87075ca5153 (patch) | |
tree | 9edb8bb7c6de029bc7381dabfd2f946f33a4b3d6 /builtin-remote.c | |
parent | 056724c6240ce79ff5ef4e91191bf7366dadba88 (diff) | |
download | git-857f8c30d79ce15b6110b0df9d3ad87075ca5153.tar.gz |
builtin-remote: Show push urls as well
Teach builtin remote to show push urls also when asked to
"show" a specific remote.
This improves upon the standard display mode: multiple specified "url"s
mean that the first one is for fetching, all are used for pushing. We
make this clearer now by displaying the first one prefixed with "Fetch
URL", and all "url"s (or, if present, all "pushurl"s) prefixed with
"Push URL".
Example with "one" having one url, "two" two urls, "three" one url and
one pushurl (URL part only):
* remote one
Fetch URL: hostone.com:/somepath/repoone.git
Push URL: hostone.com:/somepath/repoone.git
* remote two
Fetch URL: hosttwo.com:/somepath/repotwo.git
Push URL: hosttwo.com:/somepath/repotwo.git
Push URL: hosttwobackup.com:/somewheresafe/repotwo.git
* remote three
Fetch URL: http://hostthree.com/otherpath/repothree.git
Push URL: hostthree.com:/pathforpushes/repothree.git
Also, adjust t5505 accordingly and make it test for the new output.
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.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/builtin-remote.c b/builtin-remote.c index d7ab6b2d5f..8dcc6a4bf9 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -1002,15 +1002,25 @@ static int show(int argc, const char **argv) info.list = &info_list; for (; argc; argc--, argv++) { int i; + const char **url; + int url_nr; get_remote_ref_states(*argv, &states, query_flag); printf("* remote %s\n", *argv); - if (states.remote->url_nr) { - for (i=0; i < states.remote->url_nr; i++) - printf(" URL: %s\n", states.remote->url[i]); - } else - printf(" URL: %s\n", "(no URL)"); + printf(" Fetch URL: %s\n", states.remote->url_nr > 0 ? + states.remote->url[0] : "(no URL)"); + if (states.remote->pushurl_nr) { + url = states.remote->pushurl; + url_nr = states.remote->pushurl_nr; + } else { + url = states.remote->url; + url_nr = states.remote->url_nr; + } + for (i=0; i < url_nr; i++) + printf(" Push URL: %s\n", url[i]); + if (!i) + printf(" Push URL: %s\n", "(no URL)"); if (no_query) printf(" HEAD branch: (not queried)\n"); else if (!states.heads.nr) |