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 <junkio@cox.net>
Junio C Hamano committed
Oct 13, 2005 at 18:57 UTC
f6b42a81fd97a55dec0766685aac722a838a11a6
3 files changed
+16
git-fetch.sh
+1
@@ -176,6 +176,7 @@ if test "$tags"
176
then
177
taglist=$(git-ls-remote --tags "$remote" |
178
sed -e '
179
+ /\^{}$/d
180
s/^[^ ]* //
181
s/.*/&:&/')
182
if test "$#" -gt 1
server-info.c
+7
@@ -9,7 +9,14 @@ static FILE *info_ref_fp;
9
10
static int add_info_ref(const char *path, const unsigned char *sha1)
11
{
12
+ struct object *o = parse_object(sha1);
13
+
14
fprintf(info_ref_fp, "%s %s\n", sha1_to_hex(sha1), path);
15
+ if (o->type == tag_type) {
16
+ o = deref_tag(o);
17
+ fprintf(info_ref_fp, "%s %s^{}\n",
18
+ sha1_to_hex(o->sha1), path);
19
+ }
20
return 0;
21
}
22
upload-pack.c
+8
@@ -1,6 +1,8 @@
1
#include "cache.h"
2
#include "refs.h"
3
#include "pkt-line.h"
4
+#include "tag.h"
5
+#include "object.h"
6
7
static const char upload_pack_usage[] = "git-upload-pack <dir>";
8
@@ -165,7 +167,13 @@ static int receive_needs(void)
167
168
static int send_ref(const char *refname, const unsigned char *sha1)
169
{
170
+ struct object *o = parse_object(sha1);
171
+
172
packet_write(1, "%s %s\n", sha1_to_hex(sha1), refname);
173
+ if (o->type == tag_type) {
174
+ o = deref_tag(o);
175
+ packet_write(1, "%s %s^{}\n", sha1_to_hex(o->sha1), refname);
176
+ }
177
return 0;
178
}
179