{"thread":{"id":"2101","subject":"[PATCH] Show peeled onion from upload-pack and server-info.","startedAt":"2005-10-14T06:03:53Z","lastAt":"2005-10-14T06:03:53Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"10091","messageId":"7v7jcgws6u.fsf@assigned-by-dhcp.cox.net","threadId":"2101","inReplyTo":null,"subject":"[PATCH] Show peeled onion from upload-pack and server-info.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-10-14T06:03:53Z","receivedAt":"2005-10-14T06:03:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This updates git-ls-remote to show SHA1 names of objects that are\nreferred by tags, in the \"ref^{}\" notation.\n\nThis would make git-findtags (without -t flag) almost trivial.\n\n    git-peek-remote . |\n    sed -ne \"s:^$target\t\"'refs/tags/\\(.*\\)^{}$:\\1:p'\n\nAlso Pasky could do:\n\n    git-ls-remote --tags $remote |\n    sed -ne 's:\\(\trefs/tags/.*\\)^{}$:\\1:p'\n\nto find out what object each of the remote tags refers to, and\nif he has one locally, run \"git-fetch $remote tag $tagname\" to\nautomatically catch up with the upstream tags.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n git-fetch.sh  |    1 +\n server-info.c |    7 +++++++\n upload-pack.c |    8 ++++++++\n 3 files changed, 16 insertions(+), 0 deletions(-)\n\napplies-to: e03d0f32f8566817f50156b0c91972620b0f48fa\nd6cc99156c5877a8d43df75b9f55a055f4d35e02\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 7c05880..0cb1596 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -176,6 +176,7 @@ if test \"$tags\"\n then\n \ttaglist=$(git-ls-remote --tags \"$remote\" |\n \t\tsed -e '\n+\t\t\t/\\^{}$/d\n \t\t\ts/^[^\t]*\t//\n \t\t\ts/.*/&:&/')\n \tif test \"$#\" -gt 1\ndiff --git a/server-info.c b/server-info.c\nindex 3c08a28..ba53591 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -9,7 +9,14 @@ static FILE *info_ref_fp;\n \n static int add_info_ref(const char *path, const unsigned char *sha1)\n {\n+\tstruct object *o = parse_object(sha1);\n+\n \tfprintf(info_ref_fp, \"%s\t%s\\n\", sha1_to_hex(sha1), path);\n+\tif (o->type == tag_type) {\n+\t\to = deref_tag(o);\n+\t\tfprintf(info_ref_fp, \"%s\t%s^{}\\n\",\n+\t\t\tsha1_to_hex(o->sha1), path);\n+\t}\n \treturn 0;\n }\n \ndiff --git a/upload-pack.c b/upload-pack.c\nindex 83f5a35..21b4b8b 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1,6 +1,8 @@\n #include \"cache.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\n+#include \"tag.h\"\n+#include \"object.h\"\n \n static const char upload_pack_usage[] = \"git-upload-pack <dir>\";\n \n@@ -165,7 +167,13 @@ static int receive_needs(void)\n \n static int send_ref(const char *refname, const unsigned char *sha1)\n {\n+\tstruct object *o = parse_object(sha1);\n+\n \tpacket_write(1, \"%s %s\\n\", sha1_to_hex(sha1), refname);\n+\tif (o->type == tag_type) {\n+\t\to = deref_tag(o);\n+\t\tpacket_write(1, \"%s %s^{}\\n\", sha1_to_hex(o->sha1), refname);\n+\t}\n \treturn 0;\n }\n \n---\n@@GIT_VERSION@@\n"}]}