@matheusbsbs / matheus-bagliano / commits / 1974632c66
Fork 0

Remove TYPE_* constant macros and use object_type enums consistently.

This updates the type-enumeration constants introduced to reduce the memory footprint of "struct object" to match the type bits already used in the packfile format, by removing the former (i.e. TYPE_* constant macros) and using the latter (i.e. enum object_type) throughout the code for consistency. Eventually we can stop passing around the "type strings" entirely, and this will help - no confusion about two different integer enumeration. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed Jul 11, 2006 at 20:45 UTC 1974632c664c2d573b36a00fa993c1c13dd8a967
22 files changed +87 -92
blob.c
+3 -3
@@ -10,12 +10,12 @@ struct blob *lookup_blob(const unsigned char *sha1)
10 if (!obj) {
11 struct blob *ret = alloc_blob_node();
12 created_object(sha1, &ret->object);
13 - ret->object.type = TYPE_BLOB;
13 + ret->object.type = OBJ_BLOB;
14 return ret;
15 }
16 if (!obj->type)
17 - obj->type = TYPE_BLOB;
18 - if (obj->type != TYPE_BLOB) {
17 + obj->type = OBJ_BLOB;
18 + if (obj->type != OBJ_BLOB) {
19 error("Object %s is a %s, not a blob",
20 sha1_to_hex(sha1), typename(obj->type));
21 return NULL;
builtin-diff.c
+3 -3
@@ -285,9 +285,9 @@ int cmd_diff(int argc, const char **argv, char **envp)
285 obj = deref_tag(obj, NULL, 0);
286 if (!obj)
287 die("invalid object '%s' given.", name);
288 - if (obj->type == TYPE_COMMIT)
288 + if (obj->type == OBJ_COMMIT)
289 obj = &((struct commit *)obj)->tree->object;
290 - if (obj->type == TYPE_TREE) {
290 + if (obj->type == OBJ_TREE) {
291 if (ARRAY_SIZE(ent) <= ents)
292 die("more than %d trees given: '%s'",
293 (int) ARRAY_SIZE(ent), name);
@@ -297,7 +297,7 @@ int cmd_diff(int argc, const char **argv, char **envp)
297 ents++;
298 continue;
299 }
300 - if (obj->type == TYPE_BLOB) {
300 + if (obj->type == OBJ_BLOB) {
301 if (2 <= blobs)
302 die("more than two blobs given: '%s'", name);
303 memcpy(blob[blobs].sha1, obj->sha1, 20);
builtin-fmt-merge-msg.c
+1 -1
@@ -181,7 +181,7 @@ static void shortlog(const char *name, unsigned char *sha1,
181 int flags = UNINTERESTING | TREECHANGE | SEEN | SHOWN | ADDED;
182
183 branch = deref_tag(parse_object(sha1), sha1_to_hex(sha1), 40);
184 - if (!branch || branch->type != TYPE_COMMIT)
184 + if (!branch || branch->type != OBJ_COMMIT)
185 return;
186
187 setup_revisions(0, NULL, rev, NULL);
builtin-grep.c
+2 -2
@@ -891,9 +891,9 @@ static int grep_tree(struct grep_opt *opt, const char **paths,
891 static int grep_object(struct grep_opt *opt, const char **paths,
892 struct object *obj, const char *name)
893 {
894 - if (obj->type == TYPE_BLOB)
894 + if (obj->type == OBJ_BLOB)
895 return grep_sha1(opt, obj->sha1, name);
896 - if (obj->type == TYPE_COMMIT || obj->type == TYPE_TREE) {
896 + if (obj->type == OBJ_COMMIT || obj->type == OBJ_TREE) {
897 struct tree_desc tree;
898 void *data;
899 int hit;
builtin-rev-list.c
+3 -3
@@ -167,16 +167,16 @@ static void show_commit_list(struct rev_info *revs)
167 const char *name = pending->name;
168 if (obj->flags & (UNINTERESTING | SEEN))
169 continue;
170 - if (obj->type == TYPE_TAG) {
170 + if (obj->type == OBJ_TAG) {
171 obj->flags |= SEEN;
172 add_object_array(obj, name, &objects);
173 continue;
174 }
175 - if (obj->type == TYPE_TREE) {
175 + if (obj->type == OBJ_TREE) {
176 process_tree((struct tree *)obj, &objects, NULL, name);
177 continue;
178 }
179 - if (obj->type == TYPE_BLOB) {
179 + if (obj->type == OBJ_BLOB) {
180 process_blob((struct blob *)obj, &objects, NULL, name);
181 continue;
182 }
commit.c
+3 -3
@@ -56,7 +56,7 @@ static struct commit *check_commit(struct object *obj,
56 const unsigned char *sha1,
57 int quiet)
58 {
59 - if (obj->type != TYPE_COMMIT) {
59 + if (obj->type != OBJ_COMMIT) {
60 if (!quiet)
61 error("Object %s is a %s, not a commit",
62 sha1_to_hex(sha1), typename(obj->type));
@@ -86,11 +86,11 @@ struct commit *lookup_commit(const unsigned char *sha1)
86 if (!obj) {
87 struct commit *ret = alloc_commit_node();
88 created_object(sha1, &ret->object);
89 - ret->object.type = TYPE_COMMIT;
89 + ret->object.type = OBJ_COMMIT;
90 return ret;
91 }
92 if (!obj->type)
93 - obj->type = TYPE_COMMIT;
93 + obj->type = OBJ_COMMIT;
94 return check_commit(obj, sha1, 0);
95 }
96
describe.c
+1 -1
@@ -67,7 +67,7 @@ static int get_name(const char *path, const unsigned char *sha1)
67 * Otherwise only annotated tags are used.
68 */
69 if (!strncmp(path, "refs/tags/", 10)) {
70 - if (object->type == TYPE_TAG)
70 + if (object->type == OBJ_TAG)
71 prio = 2;
72 else
73 prio = 1;
fetch-pack.c
+5 -5
@@ -46,7 +46,7 @@ static int rev_list_insert_ref(const char *path, const unsigned char *sha1)
46 {
47 struct object *o = deref_tag(parse_object(sha1), path, 0);
48
49 - if (o && o->type == TYPE_COMMIT)
49 + if (o && o->type == OBJ_COMMIT)
50 rev_list_push((struct commit *)o, SEEN);
51
52 return 0;
@@ -256,14 +256,14 @@ static int mark_complete(const char *path, const unsigned char *sha1)
256 {
257 struct object *o = parse_object(sha1);
258
259 - while (o && o->type == TYPE_TAG) {
259 + while (o && o->type == OBJ_TAG) {
260 struct tag *t = (struct tag *) o;
261 if (!t->tagged)
262 break; /* broken repository */
263 o->flags |= COMPLETE;
264 o = parse_object(t->tagged->sha1);
265 }
266 - if (o && o->type == TYPE_COMMIT) {
266 + if (o && o->type == OBJ_COMMIT) {
267 struct commit *commit = (struct commit *)o;
268 commit->object.flags |= COMPLETE;
269 insert_by_date(commit, &complete);
@@ -357,7 +357,7 @@ static int everything_local(struct ref **refs, int nr_match, char **match)
357 * in sync with the other side at some time after
358 * that (it is OK if we guess wrong here).
359 */
360 - if (o->type == TYPE_COMMIT) {
360 + if (o->type == OBJ_COMMIT) {
361 struct commit *commit = (struct commit *)o;
362 if (!cutoff || cutoff < commit->date)
363 cutoff = commit->date;
@@ -376,7 +376,7 @@ static int everything_local(struct ref **refs, int nr_match, char **match)
376 struct object *o = deref_tag(lookup_object(ref->old_sha1),
377 NULL, 0);
378
379 - if (!o || o->type != TYPE_COMMIT || !(o->flags & COMPLETE))
379 + if (!o || o->type != OBJ_COMMIT || !(o->flags & COMPLETE))
380 continue;
381
382 if (!(o->flags & SEEN)) {
fetch.c
+4 -4
@@ -118,20 +118,20 @@ static struct object_list **process_queue_end = &process_queue;
118
119 static int process_object(struct object *obj)
120 {
121 - if (obj->type == TYPE_COMMIT) {
121 + if (obj->type == OBJ_COMMIT) {
122 if (process_commit((struct commit *)obj))
123 return -1;
124 return 0;
125 }
126 - if (obj->type == TYPE_TREE) {
126 + if (obj->type == OBJ_TREE) {
127 if (process_tree((struct tree *)obj))
128 return -1;
129 return 0;
130 }
131 - if (obj->type == TYPE_BLOB) {
131 + if (obj->type == OBJ_BLOB) {
132 return 0;
133 }
134 - if (obj->type == TYPE_TAG) {
134 + if (obj->type == OBJ_TAG) {
135 if (process_tag((struct tag *)obj))
136 return -1;
137 return 0;
fsck-objects.c
+5 -5
@@ -297,13 +297,13 @@ static int fsck_sha1(unsigned char *sha1)
297 if (obj->flags & SEEN)
298 return 0;
299 obj->flags |= SEEN;
300 - if (obj->type == TYPE_BLOB)
300 + if (obj->type == OBJ_BLOB)
301 return 0;
302 - if (obj->type == TYPE_TREE)
302 + if (obj->type == OBJ_TREE)
303 return fsck_tree((struct tree *) obj);
304 - if (obj->type == TYPE_COMMIT)
304 + if (obj->type == OBJ_COMMIT)
305 return fsck_commit((struct commit *) obj);
306 - if (obj->type == TYPE_TAG)
306 + if (obj->type == OBJ_TAG)
307 return fsck_tag((struct tag *) obj);
308 /* By now, parse_object() would've returned NULL instead. */
309 return objerror(obj, "unknown type '%d' (internal fsck error)", obj->type);
@@ -472,7 +472,7 @@ static int fsck_cache_tree(struct cache_tree *it)
472 }
473 mark_reachable(obj, REACHABLE);
474 obj->used = 1;
475 - if (obj->type != TYPE_TREE)
475 + if (obj->type != OBJ_TREE)
476 err |= objerror(obj, "non-tree in cache-tree");
477 }
478 for (i = 0; i < it->subtree_nr; i++)
http-push.c
+6 -6
@@ -1784,16 +1784,16 @@ static int get_delta(struct rev_info *revs, struct remote_lock *lock)
1784
1785 if (obj->flags & (UNINTERESTING | SEEN))
1786 continue;
1787 - if (obj->type == TYPE_TAG) {
1787 + if (obj->type == OBJ_TAG) {
1788 obj->flags |= SEEN;
1789 p = add_one_object(obj, p);
1790 continue;
1791 }
1792 - if (obj->type == TYPE_TREE) {
1792 + if (obj->type == OBJ_TREE) {
1793 p = process_tree((struct tree *)obj, p, NULL, name);
1794 continue;
1795 }
1796 - if (obj->type == TYPE_BLOB) {
1796 + if (obj->type == OBJ_BLOB) {
1797 p = process_blob((struct blob *)obj, p, NULL, name);
1798 continue;
1799 }
@@ -1960,12 +1960,12 @@ static int ref_newer(const unsigned char *new_sha1,
1960 * old. Otherwise we require --force.
1961 */
1962 o = deref_tag(parse_object(old_sha1), NULL, 0);
1963 - if (!o || o->type != TYPE_COMMIT)
1963 + if (!o || o->type != OBJ_COMMIT)
1964 return 0;
1965 old = (struct commit *) o;
1966
1967 o = deref_tag(parse_object(new_sha1), NULL, 0);
1968 - if (!o || o->type != TYPE_COMMIT)
1968 + if (!o || o->type != OBJ_COMMIT)
1969 return 0;
1970 new = (struct commit *) o;
1971
@@ -2044,7 +2044,7 @@ static void add_remote_info_ref(struct remote_ls_ctx *ls)
2044 fwrite_buffer(ref_info, 1, len, buf);
2045 free(ref_info);
2046
2047 - if (o->type == TYPE_TAG) {
2047 + if (o->type == OBJ_TAG) {
2048 o = deref_tag(o, ls->dentry_name, 0);
2049 if (o) {
2050 len = strlen(ls->dentry_name) + 45;
name-rev.c
+4 -4
@@ -84,14 +84,14 @@ static int name_ref(const char *path, const unsigned char *sha1)
84 if (tags_only && strncmp(path, "refs/tags/", 10))
85 return 0;
86
87 - while (o && o->type == TYPE_TAG) {
87 + while (o && o->type == OBJ_TAG) {
88 struct tag *t = (struct tag *) o;
89 if (!t->tagged)
90 break; /* broken repository */
91 o = parse_object(t->tagged->sha1);
92 deref = 1;
93 }
94 - if (o && o->type == TYPE_COMMIT) {
94 + if (o && o->type == OBJ_COMMIT) {
95 struct commit *commit = (struct commit *)o;
96
97 if (!strncmp(path, "refs/heads/", 11))
@@ -111,7 +111,7 @@ static const char* get_rev_name(struct object *o)
111 struct rev_name *n;
112 struct commit *c;
113
114 - if (o->type != TYPE_COMMIT)
114 + if (o->type != OBJ_COMMIT)
115 return "undefined";
116 c = (struct commit *) o;
117 n = c->util;
@@ -172,7 +172,7 @@ int main(int argc, char **argv)
172 }
173
174 o = deref_tag(parse_object(sha1), *argv, 0);
175 - if (!o || o->type != TYPE_COMMIT) {
175 + if (!o || o->type != OBJ_COMMIT) {
176 fprintf(stderr, "Could not get commit for %s. Skipping.\n",
177 *argv);
178 continue;
object.c
+4 -3
@@ -19,7 +19,8 @@ struct object *get_indexed_object(unsigned int idx)
19 }
20
21 const char *type_names[] = {
22 - "none", "blob", "tree", "commit", "bad"
22 + "none", "commit", "tree", "blob", "tag",
23 + "bad type 5", "bad type 6", "delta", "bad",
24 };
25
26 static unsigned int hash_obj(struct object *obj, unsigned int n)
@@ -88,7 +89,7 @@ void created_object(const unsigned char *sha1, struct object *obj)
89 {
90 obj->parsed = 0;
91 obj->used = 0;
91 - obj->type = TYPE_NONE;
92 + obj->type = OBJ_NONE;
93 obj->flags = 0;
94 memcpy(obj->sha1, sha1, 20);
95
@@ -131,7 +132,7 @@ struct object *lookup_unknown_object(const unsigned char *sha1)
132 if (!obj) {
133 union any_object *ret = xcalloc(1, sizeof(*ret));
134 created_object(sha1, &ret->object);
134 - ret->object.type = TYPE_NONE;
135 + ret->object.type = OBJ_NONE;
136 return &ret->object;
137 }
138 return obj;
object.h
+15 -8
@@ -24,12 +24,19 @@ struct object_array {
24 #define TYPE_BITS 3
25 #define FLAG_BITS 27
26
27 -#define TYPE_NONE 0
28 -#define TYPE_BLOB 1
29 -#define TYPE_TREE 2
30 -#define TYPE_COMMIT 3
31 -#define TYPE_TAG 4
32 -#define TYPE_BAD 5
27 +/*
28 + * The object type is stored in 3 bits.
29 + */
30 +enum object_type {
31 + OBJ_NONE = 0,
32 + OBJ_COMMIT = 1,
33 + OBJ_TREE = 2,
34 + OBJ_BLOB = 3,
35 + OBJ_TAG = 4,
36 + /* 5/6 for future expansion */
37 + OBJ_DELTA = 7,
38 + OBJ_BAD,
39 +};
40
41 struct object {
42 unsigned parsed : 1;
@@ -40,14 +47,14 @@ struct object {
47 };
48
49 extern int track_object_refs;
43 -extern const char *type_names[];
50 +extern const char *type_names[9];
51
52 extern unsigned int get_max_object_index(void);
53 extern struct object *get_indexed_object(unsigned int);
54
55 static inline const char *typename(unsigned int type)
56 {
50 - return type_names[type > TYPE_TAG ? TYPE_BAD : type];
57 + return type_names[type > OBJ_BAD ? OBJ_BAD : type];
58 }
59
60 extern struct object_refs *lookup_object_refs(struct object *);
pack.h
+1 -14
@@ -1,20 +1,7 @@
1 #ifndef PACK_H
2 #define PACK_H
3
4 -/*
5 - * The packed object type is stored in 3 bits.
6 - * The type value 0 is a reserved prefix if ever there is more than 7
7 - * object types, or any future format extensions.
8 - */
9 -enum object_type {
10 - OBJ_EXT = 0,
11 - OBJ_COMMIT = 1,
12 - OBJ_TREE = 2,
13 - OBJ_BLOB = 3,
14 - OBJ_TAG = 4,
15 - /* 5/6 for future expansion */
16 - OBJ_DELTA = 7,
17 -};
4 +#include "object.h"
5
6 /*
7 * Packed object header
revision.c
+6 -6
@@ -135,7 +135,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
135 /*
136 * Tag object? Look what it points to..
137 */
138 - while (object->type == TYPE_TAG) {
138 + while (object->type == OBJ_TAG) {
139 struct tag *tag = (struct tag *) object;
140 if (revs->tag_objects && !(flags & UNINTERESTING))
141 add_pending_object(revs, object, tag->tag);
@@ -148,7 +148,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
148 * Commit object? Just return it, we'll do all the complex
149 * reachability crud.
150 */
151 - if (object->type == TYPE_COMMIT) {
151 + if (object->type == OBJ_COMMIT) {
152 struct commit *commit = (struct commit *)object;
153 if (parse_commit(commit) < 0)
154 die("unable to parse commit %s", name);
@@ -164,7 +164,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
164 * Tree object? Either mark it uniniteresting, or add it
165 * to the list of objects to look at later..
166 */
167 - if (object->type == TYPE_TREE) {
167 + if (object->type == OBJ_TREE) {
168 struct tree *tree = (struct tree *)object;
169 if (!revs->tree_objects)
170 return NULL;
@@ -179,7 +179,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
179 /*
180 * Blob object? You know the drill by now..
181 */
182 - if (object->type == TYPE_BLOB) {
182 + if (object->type == OBJ_BLOB) {
183 struct blob *blob = (struct blob *)object;
184 if (!revs->blob_objects)
185 return NULL;
@@ -494,11 +494,11 @@ static int add_parents_only(struct rev_info *revs, const char *arg, int flags)
494 return 0;
495 while (1) {
496 it = get_reference(revs, arg, sha1, 0);
497 - if (it->type != TYPE_TAG)
497 + if (it->type != OBJ_TAG)
498 break;
499 memcpy(sha1, ((struct tag*)it)->tagged->sha1, 20);
500 }
501 - if (it->type != TYPE_COMMIT)
501 + if (it->type != OBJ_COMMIT)
502 return 0;
503 commit = (struct commit *)it;
504 for (parents = commit->parents; parents; parents = parents->next) {
send-pack.c
+2 -2
@@ -151,12 +151,12 @@ static int ref_newer(const unsigned char *new_sha1,
151 * old. Otherwise we require --force.
152 */
153 o = deref_tag(parse_object(old_sha1), NULL, 0);
154 - if (!o || o->type != TYPE_COMMIT)
154 + if (!o || o->type != OBJ_COMMIT)
155 return 0;
156 old = (struct commit *) o;
157
158 o = deref_tag(parse_object(new_sha1), NULL, 0);
159 - if (!o || o->type != TYPE_COMMIT)
159 + if (!o || o->type != OBJ_COMMIT)
160 return 0;
161 new = (struct commit *) o;
162
server-info.c
+1 -1
@@ -12,7 +12,7 @@ static int add_info_ref(const char *path, const unsigned char *sha1)
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 == TYPE_TAG) {
15 + if (o->type == OBJ_TAG) {
16 o = deref_tag(o, path, 0);
17 if (o)
18 fprintf(info_ref_fp, "%s %s^{}\n",
sha1_name.c
+6 -6
@@ -381,13 +381,13 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
381
382 sp++; /* beginning of type name, or closing brace for empty */
383 if (!strncmp(commit_type, sp, 6) && sp[6] == '}')
384 - expected_type = TYPE_COMMIT;
384 + expected_type = OBJ_COMMIT;
385 else if (!strncmp(tree_type, sp, 4) && sp[4] == '}')
386 - expected_type = TYPE_TREE;
386 + expected_type = OBJ_TREE;
387 else if (!strncmp(blob_type, sp, 4) && sp[4] == '}')
388 - expected_type = TYPE_BLOB;
388 + expected_type = OBJ_BLOB;
389 else if (sp[0] == '}')
390 - expected_type = TYPE_NONE;
390 + expected_type = OBJ_NONE;
391 else
392 return -1;
393
@@ -416,9 +416,9 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
416 memcpy(sha1, o->sha1, 20);
417 return 0;
418 }
419 - if (o->type == TYPE_TAG)
419 + if (o->type == OBJ_TAG)
420 o = ((struct tag*) o)->tagged;
421 - else if (o->type == TYPE_COMMIT)
421 + else if (o->type == OBJ_COMMIT)
422 o = &(((struct commit *) o)->tree->object);
423 else
424 return error("%.*s: expected %s type, but the object dereferences to %s type",
tag.c
+4 -4
@@ -5,7 +5,7 @@ const char *tag_type = "tag";
5
6 struct object *deref_tag(struct object *o, const char *warn, int warnlen)
7 {
8 - while (o && o->type == TYPE_TAG)
8 + while (o && o->type == OBJ_TAG)
9 o = parse_object(((struct tag *)o)->tagged->sha1);
10 if (!o && warn) {
11 if (!warnlen)
@@ -21,12 +21,12 @@ struct tag *lookup_tag(const unsigned char *sha1)
21 if (!obj) {
22 struct tag *ret = alloc_tag_node();
23 created_object(sha1, &ret->object);
24 - ret->object.type = TYPE_TAG;
24 + ret->object.type = OBJ_TAG;
25 return ret;
26 }
27 if (!obj->type)
28 - obj->type = TYPE_TAG;
29 - if (obj->type != TYPE_TAG) {
28 + obj->type = OBJ_TAG;
29 + if (obj->type != OBJ_TAG) {
30 error("Object %s is a %s, not a tree",
31 sha1_to_hex(sha1), typename(obj->type));
32 return NULL;
tree.c
+6 -6
@@ -131,12 +131,12 @@ struct tree *lookup_tree(const unsigned char *sha1)
131 if (!obj) {
132 struct tree *ret = alloc_tree_node();
133 created_object(sha1, &ret->object);
134 - ret->object.type = TYPE_TREE;
134 + ret->object.type = OBJ_TREE;
135 return ret;
136 }
137 if (!obj->type)
138 - obj->type = TYPE_TREE;
139 - if (obj->type != TYPE_TREE) {
138 + obj->type = OBJ_TREE;
139 + if (obj->type != OBJ_TREE) {
140 error("Object %s is a %s, not a tree",
141 sha1_to_hex(sha1), typename(obj->type));
142 return NULL;
@@ -216,11 +216,11 @@ struct tree *parse_tree_indirect(const unsigned char *sha1)
216 do {
217 if (!obj)
218 return NULL;
219 - if (obj->type == TYPE_TREE)
219 + if (obj->type == OBJ_TREE)
220 return (struct tree *) obj;
221 - else if (obj->type == TYPE_COMMIT)
221 + else if (obj->type == OBJ_COMMIT)
222 obj = &(((struct commit *) obj)->tree->object);
223 - else if (obj->type == TYPE_TAG)
223 + else if (obj->type == OBJ_TAG)
224 obj = ((struct tag *) obj)->tagged;
225 else
226 return NULL;
upload-pack.c
+2 -2
@@ -326,7 +326,7 @@ static int got_sha1(char *hex, unsigned char *sha1)
326 o = parse_object(sha1);
327 if (!o)
328 die("oops (%s)", sha1_to_hex(sha1));
329 - if (o->type == TYPE_COMMIT) {
329 + if (o->type == OBJ_COMMIT) {
330 struct commit_list *parents;
331 if (o->flags & THEY_HAVE)
332 return 0;
@@ -457,7 +457,7 @@ static int send_ref(const char *refname, const unsigned char *sha1)
457 o->flags |= OUR_REF;
458 nr_our_refs++;
459 }
460 - if (o->type == TYPE_TAG) {
460 + if (o->type == OBJ_TAG) {
461 o = deref_tag(o, refname, 0);
462 packet_write(1, "%s %s^{}\n", sha1_to_hex(o->sha1), refname);
463 }