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) diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index e70246b3fb..852ccb5d7d 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -135,7 +135,8 @@ EOF cat > test/expect << EOF * remote origin - URL: $(pwd)/one + Fetch URL: $(pwd)/one + Push URL: $(pwd)/one HEAD branch: master Remote branches: master new (next fetch will store in remotes/origin) @@ -151,7 +152,8 @@ cat > test/expect << EOF master pushes to master (local out of date) master pushes to upstream (create) * remote two - URL: ../two + Fetch URL: ../two + Push URL: ../three HEAD branch (remote HEAD is ambiguous, may be one of the following): another master @@ -173,6 +175,7 @@ test_expect_success 'show' ' git branch --track rebase origin/master && git branch -d -r origin/master && git config --add remote.two.url ../two && + git config --add remote.two.pushurl ../three && git config branch.rebase.rebase true && git config branch.octopus.merge "topic-a topic-b topic-c" && (cd ../one && @@ -191,7 +194,8 @@ test_expect_success 'show' ' cat > test/expect << EOF * remote origin - URL: $(pwd)/one + Fetch URL: $(pwd)/one + Push URL: $(pwd)/one HEAD branch: (not queried) Remote branches: (status not queried) master