{"thread":{"id":"10693","subject":"[PATCH] Reteach builtin-ls-remote to understand remotes","startedAt":"2007-11-07T01:29:20Z","lastAt":"2007-11-07T06:24:11Z","messageCount":2,"participants":["Shawn O. Pearce","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"58627","messageId":"20071107012920.GA9961@spearce.org","threadId":"10693","inReplyTo":null,"subject":"[PATCH] Reteach builtin-ls-remote to understand remotes","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-11-07T01:29:20Z","receivedAt":"2007-11-07T01:29:20Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Prior to being made a builtin git-ls-remote understood that when\nit was given a remote name we wanted it to resolve that to the\npre-configured URL and connect to that location.  That changed when\nit was converted to a builtin and many of my automation tools broke.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n builtin-ls-remote.c |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-ls-remote.c b/builtin-ls-remote.c\nindex 003580c..56f3f88 100644\n--- a/builtin-ls-remote.c\n+++ b/builtin-ls-remote.c\n@@ -14,6 +14,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)\n \tunsigned flags = 0;\n \tconst char *uploadpack = NULL;\n \n+\tstruct remote *remote;\n \tstruct transport *transport;\n \tconst struct ref *ref;\n \n@@ -52,7 +53,10 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)\n \tif (!dest || i != argc - 1)\n \t\tusage(ls_remote_usage);\n \n-\ttransport = transport_get(NULL, dest);\n+\tremote = nongit ? NULL : remote_get(dest);\n+\tif (remote && !remote->url_nr)\n+\t\tdie(\"remote %s has no configured URL\", dest);\n+\ttransport = transport_get(remote, remote ? remote->url[0] : dest);\n \tif (uploadpack != NULL)\n \t\ttransport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack);\n \n-- \n1.5.3.5.1590.gfadfad\n"},{"id":"58636","messageId":"7vtznyefp0.fsf@gitster.siamese.dyndns.org","threadId":"10693","inReplyTo":"20071107012920.GA9961@spearce.org","subject":"Re: [PATCH] Reteach builtin-ls-remote to understand remotes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-11-07T06:24:11Z","receivedAt":"2007-11-07T06:24:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> Prior to being made a builtin git-ls-remote understood that when\n> it was given a remote name we wanted it to resolve that to the\n> pre-configured URL and connect to that location.  That changed when\n> it was converted to a builtin and many of my automation tools broke.\n\nThanks.  I will squash this in.\n\n---\ndiff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh\nnew file mode 100755\nindex 0000000..6ec5f7c\n--- /dev/null\n+++ b/t/t5512-ls-remote.sh\n@@ -0,0 +1,52 @@\n+#!/bin/sh\n+\n+test_description='git ls-remote'\n+\n+. ./test-lib.sh\n+\n+test_expect_success setup '\n+\n+\t>file &&\n+\tgit add file &&\n+\ttest_tick &&\n+\tgit commit -m initial &&\n+\tgit tag mark &&\n+\tgit show-ref --tags -d | sed -e \"s/ /\t/\" >expected.tag &&\n+\t(\n+\t\techo \"$(git rev-parse HEAD)\tHEAD\"\n+\t\tgit show-ref -d\t| sed -e \"s/ /\t/\"\n+\t) >expected.all &&\n+\n+\tgit remote add self $(pwd)/.git\n+\n+'\n+\n+test_expect_success 'ls-remote --tags .git' '\n+\n+\tgit ls-remote --tags .git >actual &&\n+\tdiff -u expected.tag actual\n+\n+'\n+\n+test_expect_success 'ls-remote .git' '\n+\n+\tgit ls-remote .git >actual &&\n+\tdiff -u expected.all actual\n+\n+'\n+\n+test_expect_success 'ls-remote --tags self' '\n+\n+\tgit ls-remote --tags self >actual &&\n+\tdiff -u expected.tag actual\n+\n+'\n+\n+test_expect_success 'ls-remote self' '\n+\n+\tgit ls-remote self >actual &&\n+\tdiff -u expected.all actual\n+\n+'\n+\n+test_done\n"}]}