From 45781adb9a89c0c47f61ccf8062be26b86a38a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Tue, 1 Mar 2011 10:21:36 +0100 Subject: get_remote_url(): use the same data source as ls-remote to get remote urls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The formerly implemented algorithm behaved differently to remote.c:remote_get() at least for remotes that contain a slash. While the former just assumes a/b is a path the latter checks the config for remote."a/b" first which is more reasonable. This removes the last user of git-parse-remote.sh:get_data_source(), so this function is removed. Signed-off-by: Uwe Kleine-König Signed-off-by: Junio C Hamano --- builtin/ls-remote.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'builtin/ls-remote.c') diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 97eed4012b..1a1ff87e8f 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -33,6 +33,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) int i; const char *dest = NULL; unsigned flags = 0; + int get_url = 0; int quiet = 0; const char *uploadpack = NULL; const char **pattern = NULL; @@ -69,6 +70,10 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) quiet = 1; continue; } + if (!strcmp("--get-url", arg)) { + get_url = 1; + continue; + } usage(ls_remote_usage); } dest = arg; @@ -94,6 +99,12 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) } if (!remote->url_nr) die("remote %s has no configured URL", dest); + + if (get_url) { + printf("%s\n", *remote->url); + return 0; + } + transport = transport_get(remote, NULL); if (uploadpack != NULL) transport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack); -- cgit v1.2.1