path: root/upload-pack.c
diff options
authorJunio C Hamano <>2005-10-14 01:57:40 (GMT)
committerJunio C Hamano <>2005-10-15 18:23:41 (GMT)
commitf6b42a81fd97a55dec0766685aac722a838a11a6 (patch)
treee28da137e465b5caa12ba6b05aae9fe4dc4b46c8 /upload-pack.c
parent5385f52da80be0d01fda45be586eb186c2be83ee (diff)
Show peeled onion from upload-pack and server-info.
This updates git-ls-remote to show SHA1 names of objects that are referred by tags, in the "ref^{}" notation. This would make git-findtags (without -t flag) almost trivial. git-peek-remote . | sed -ne "s:^$target "'refs/tags/\(.*\)^{}$:\1:p' Also Pasky could do: git-ls-remote --tags $remote | sed -ne 's:\( refs/tags/.*\)^{}$:\1:p' to find out what object each of the remote tags refers to, and if he has one locally, run "git-fetch $remote tag $tagname" to automatically catch up with the upstream tags. Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'upload-pack.c')
1 files changed, 8 insertions, 0 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 83f5a35..21b4b8b 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -1,6 +1,8 @@
#include "cache.h"
#include "refs.h"
#include "pkt-line.h"
+#include "tag.h"
+#include "object.h"
static const char upload_pack_usage[] = "git-upload-pack <dir>";
@@ -165,7 +167,13 @@ static int receive_needs(void)
static int send_ref(const char *refname, const unsigned char *sha1)
+ struct object *o = parse_object(sha1);
packet_write(1, "%s %s\n", sha1_to_hex(sha1), refname);
+ if (o->type == tag_type) {
+ o = deref_tag(o);
+ packet_write(1, "%s %s^{}\n", sha1_to_hex(o->sha1), refname);
+ }
return 0;