summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d3ba675)
raw | patch | inline | side by side (parent: d3ba675)
author | Linus Torvalds <torvalds@osdl.org> | |
Wed, 12 Jul 2006 03:45:31 +0000 (20:45 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 13 Jul 2006 06:18:03 +0000 (23:18 -0700) |
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>
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>
22 files changed:
blob.c | patch | blob | history | |
builtin-diff.c | patch | blob | history | |
builtin-fmt-merge-msg.c | patch | blob | history | |
builtin-grep.c | patch | blob | history | |
builtin-rev-list.c | patch | blob | history | |
commit.c | patch | blob | history | |
describe.c | patch | blob | history | |
fetch-pack.c | patch | blob | history | |
fetch.c | patch | blob | history | |
fsck-objects.c | patch | blob | history | |
http-push.c | patch | blob | history | |
name-rev.c | patch | blob | history | |
object.c | patch | blob | history | |
object.h | patch | blob | history | |
pack.h | patch | blob | history | |
revision.c | patch | blob | history | |
send-pack.c | patch | blob | history | |
server-info.c | patch | blob | history | |
sha1_name.c | patch | blob | history | |
tag.c | patch | blob | history | |
tree.c | patch | blob | history | |
upload-pack.c | patch | blob | history |
index 496f270043a617242efa9d27285853feb2597484..d1af2e62f14965fab491a3d9dde712f02b718adc 100644 (file)
--- a/blob.c
+++ b/blob.c
if (!obj) {
struct blob *ret = alloc_blob_node();
created_object(sha1, &ret->object);
- ret->object.type = TYPE_BLOB;
+ ret->object.type = OBJ_BLOB;
return ret;
}
if (!obj->type)
- obj->type = TYPE_BLOB;
- if (obj->type != TYPE_BLOB) {
+ obj->type = OBJ_BLOB;
+ if (obj->type != OBJ_BLOB) {
error("Object %s is a %s, not a blob",
sha1_to_hex(sha1), typename(obj->type));
return NULL;
diff --git a/builtin-diff.c b/builtin-diff.c
index ae901dd25ea4d8d82752db5b28f354fd2eadfb56..cb38f445611735cff5bc9fbafb3189e6ccc6c2fd 100644 (file)
--- a/builtin-diff.c
+++ b/builtin-diff.c
obj = deref_tag(obj, NULL, 0);
if (!obj)
die("invalid object '%s' given.", name);
- if (obj->type == TYPE_COMMIT)
+ if (obj->type == OBJ_COMMIT)
obj = &((struct commit *)obj)->tree->object;
- if (obj->type == TYPE_TREE) {
+ if (obj->type == OBJ_TREE) {
if (ARRAY_SIZE(ent) <= ents)
die("more than %d trees given: '%s'",
(int) ARRAY_SIZE(ent), name);
ents++;
continue;
}
- if (obj->type == TYPE_BLOB) {
+ if (obj->type == OBJ_BLOB) {
if (2 <= blobs)
die("more than two blobs given: '%s'", name);
memcpy(blob[blobs].sha1, obj->sha1, 20);
index fe0ef44b4051e74b10e14d6a694aaad98a005397..f20b27b8a9cfd78ad5ae8ba67f08ec25849394e2 100644 (file)
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
int flags = UNINTERESTING | TREECHANGE | SEEN | SHOWN | ADDED;
branch = deref_tag(parse_object(sha1), sha1_to_hex(sha1), 40);
- if (!branch || branch->type != TYPE_COMMIT)
+ if (!branch || branch->type != OBJ_COMMIT)
return;
setup_revisions(0, NULL, rev, NULL);
diff --git a/builtin-grep.c b/builtin-grep.c
index 4c2f7dfe03086af3e638f19a541d6c281aba927c..a79bac305aea880d6decb787836fe86295ead32e 100644 (file)
--- a/builtin-grep.c
+++ b/builtin-grep.c
static int grep_object(struct grep_opt *opt, const char **paths,
struct object *obj, const char *name)
{
- if (obj->type == TYPE_BLOB)
+ if (obj->type == OBJ_BLOB)
return grep_sha1(opt, obj->sha1, name);
- if (obj->type == TYPE_COMMIT || obj->type == TYPE_TREE) {
+ if (obj->type == OBJ_COMMIT || obj->type == OBJ_TREE) {
struct tree_desc tree;
void *data;
int hit;
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 63bad0e96ade657bef21d9ca0e0de2e0ba8af61c..8f328713374679b023f1f8caaacab592c9e4f9a2 100644 (file)
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
const char *name = pending->name;
if (obj->flags & (UNINTERESTING | SEEN))
continue;
- if (obj->type == TYPE_TAG) {
+ if (obj->type == OBJ_TAG) {
obj->flags |= SEEN;
add_object_array(obj, name, &objects);
continue;
}
- if (obj->type == TYPE_TREE) {
+ if (obj->type == OBJ_TREE) {
process_tree((struct tree *)obj, &objects, NULL, name);
continue;
}
- if (obj->type == TYPE_BLOB) {
+ if (obj->type == OBJ_BLOB) {
process_blob((struct blob *)obj, &objects, NULL, name);
continue;
}
diff --git a/commit.c b/commit.c
index 522a6f3aca644f968b825abf83e1fa6474b559eb..4c5aac8765a541e92b3de25c2118908221e55c6f 100644 (file)
--- a/commit.c
+++ b/commit.c
const unsigned char *sha1,
int quiet)
{
- if (obj->type != TYPE_COMMIT) {
+ if (obj->type != OBJ_COMMIT) {
if (!quiet)
error("Object %s is a %s, not a commit",
sha1_to_hex(sha1), typename(obj->type));
if (!obj) {
struct commit *ret = alloc_commit_node();
created_object(sha1, &ret->object);
- ret->object.type = TYPE_COMMIT;
+ ret->object.type = OBJ_COMMIT;
return ret;
}
if (!obj->type)
- obj->type = TYPE_COMMIT;
+ obj->type = OBJ_COMMIT;
return check_commit(obj, sha1, 0);
}
diff --git a/describe.c b/describe.c
index 8e68d5df3303ed75c2fbb9c8b3d1025785a622c7..324ca8965b9512de59b515cdcc29801022553d1d 100644 (file)
--- a/describe.c
+++ b/describe.c
* Otherwise only annotated tags are used.
*/
if (!strncmp(path, "refs/tags/", 10)) {
- if (object->type == TYPE_TAG)
+ if (object->type == OBJ_TAG)
prio = 2;
else
prio = 1;
diff --git a/fetch-pack.c b/fetch-pack.c
index f2c51ebe4b2b524e5d5bce6af8aa3105df19f177..b7824dbed4e10d912a0977865e24e21ff9295aae 100644 (file)
--- a/fetch-pack.c
+++ b/fetch-pack.c
{
struct object *o = deref_tag(parse_object(sha1), path, 0);
- if (o && o->type == TYPE_COMMIT)
+ if (o && o->type == OBJ_COMMIT)
rev_list_push((struct commit *)o, SEEN);
return 0;
{
struct object *o = parse_object(sha1);
- while (o && o->type == TYPE_TAG) {
+ while (o && o->type == OBJ_TAG) {
struct tag *t = (struct tag *) o;
if (!t->tagged)
break; /* broken repository */
o->flags |= COMPLETE;
o = parse_object(t->tagged->sha1);
}
- if (o && o->type == TYPE_COMMIT) {
+ if (o && o->type == OBJ_COMMIT) {
struct commit *commit = (struct commit *)o;
commit->object.flags |= COMPLETE;
insert_by_date(commit, &complete);
* in sync with the other side at some time after
* that (it is OK if we guess wrong here).
*/
- if (o->type == TYPE_COMMIT) {
+ if (o->type == OBJ_COMMIT) {
struct commit *commit = (struct commit *)o;
if (!cutoff || cutoff < commit->date)
cutoff = commit->date;
struct object *o = deref_tag(lookup_object(ref->old_sha1),
NULL, 0);
- if (!o || o->type != TYPE_COMMIT || !(o->flags & COMPLETE))
+ if (!o || o->type != OBJ_COMMIT || !(o->flags & COMPLETE))
continue;
if (!(o->flags & SEEN)) {
index 238032b798008cd1f96d5083b63dc582f8191a1d..989d7a47884ec7bac05d329baeb97bdb12b7b22e 100644 (file)
--- a/fetch.c
+++ b/fetch.c
static int process_object(struct object *obj)
{
- if (obj->type == TYPE_COMMIT) {
+ if (obj->type == OBJ_COMMIT) {
if (process_commit((struct commit *)obj))
return -1;
return 0;
}
- if (obj->type == TYPE_TREE) {
+ if (obj->type == OBJ_TREE) {
if (process_tree((struct tree *)obj))
return -1;
return 0;
}
- if (obj->type == TYPE_BLOB) {
+ if (obj->type == OBJ_BLOB) {
return 0;
}
- if (obj->type == TYPE_TAG) {
+ if (obj->type == OBJ_TAG) {
if (process_tag((struct tag *)obj))
return -1;
return 0;
diff --git a/fsck-objects.c b/fsck-objects.c
index ef54a8a411b01bb4f6becd24c68fad3fcbd15211..e167f4105ffcf50f0ebfe03378b687569b6a668e 100644 (file)
--- a/fsck-objects.c
+++ b/fsck-objects.c
if (obj->flags & SEEN)
return 0;
obj->flags |= SEEN;
- if (obj->type == TYPE_BLOB)
+ if (obj->type == OBJ_BLOB)
return 0;
- if (obj->type == TYPE_TREE)
+ if (obj->type == OBJ_TREE)
return fsck_tree((struct tree *) obj);
- if (obj->type == TYPE_COMMIT)
+ if (obj->type == OBJ_COMMIT)
return fsck_commit((struct commit *) obj);
- if (obj->type == TYPE_TAG)
+ if (obj->type == OBJ_TAG)
return fsck_tag((struct tag *) obj);
/* By now, parse_object() would've returned NULL instead. */
return objerror(obj, "unknown type '%d' (internal fsck error)", obj->type);
}
mark_reachable(obj, REACHABLE);
obj->used = 1;
- if (obj->type != TYPE_TREE)
+ if (obj->type != OBJ_TREE)
err |= objerror(obj, "non-tree in cache-tree");
}
for (i = 0; i < it->subtree_nr; i++)
diff --git a/http-push.c b/http-push.c
index f761584d7edf25147b731405c2996478c7177935..47686195cdf41ad58fe66a606033d3156de8fd82 100644 (file)
--- a/http-push.c
+++ b/http-push.c
if (obj->flags & (UNINTERESTING | SEEN))
continue;
- if (obj->type == TYPE_TAG) {
+ if (obj->type == OBJ_TAG) {
obj->flags |= SEEN;
p = add_one_object(obj, p);
continue;
}
- if (obj->type == TYPE_TREE) {
+ if (obj->type == OBJ_TREE) {
p = process_tree((struct tree *)obj, p, NULL, name);
continue;
}
- if (obj->type == TYPE_BLOB) {
+ if (obj->type == OBJ_BLOB) {
p = process_blob((struct blob *)obj, p, NULL, name);
continue;
}
* old. Otherwise we require --force.
*/
o = deref_tag(parse_object(old_sha1), NULL, 0);
- if (!o || o->type != TYPE_COMMIT)
+ if (!o || o->type != OBJ_COMMIT)
return 0;
old = (struct commit *) o;
o = deref_tag(parse_object(new_sha1), NULL, 0);
- if (!o || o->type != TYPE_COMMIT)
+ if (!o || o->type != OBJ_COMMIT)
return 0;
new = (struct commit *) o;
fwrite_buffer(ref_info, 1, len, buf);
free(ref_info);
- if (o->type == TYPE_TAG) {
+ if (o->type == OBJ_TAG) {
o = deref_tag(o, ls->dentry_name, 0);
if (o) {
len = strlen(ls->dentry_name) + 45;
diff --git a/name-rev.c b/name-rev.c
index 083d067e17f6bfbdbd936b0fbe3683ac4f1f7b5b..f92f14e32f647527e8bf49fced6c632be7298985 100644 (file)
--- a/name-rev.c
+++ b/name-rev.c
if (tags_only && strncmp(path, "refs/tags/", 10))
return 0;
- while (o && o->type == TYPE_TAG) {
+ while (o && o->type == OBJ_TAG) {
struct tag *t = (struct tag *) o;
if (!t->tagged)
break; /* broken repository */
o = parse_object(t->tagged->sha1);
deref = 1;
}
- if (o && o->type == TYPE_COMMIT) {
+ if (o && o->type == OBJ_COMMIT) {
struct commit *commit = (struct commit *)o;
if (!strncmp(path, "refs/heads/", 11))
struct rev_name *n;
struct commit *c;
- if (o->type != TYPE_COMMIT)
+ if (o->type != OBJ_COMMIT)
return "undefined";
c = (struct commit *) o;
n = c->util;
}
o = deref_tag(parse_object(sha1), *argv, 0);
- if (!o || o->type != TYPE_COMMIT) {
+ if (!o || o->type != OBJ_COMMIT) {
fprintf(stderr, "Could not get commit for %s. Skipping.\n",
*argv);
continue;
diff --git a/object.c b/object.c
index 37277f94384fff1320381a370dd4d6c91a4ded2c..b5d8ed467d1c10c2f2dd596717159f7ee48a8007 100644 (file)
--- a/object.c
+++ b/object.c
}
const char *type_names[] = {
- "none", "blob", "tree", "commit", "bad"
+ "none", "commit", "tree", "blob", "tag",
+ "bad type 5", "bad type 6", "delta", "bad",
};
static unsigned int hash_obj(struct object *obj, unsigned int n)
{
obj->parsed = 0;
obj->used = 0;
- obj->type = TYPE_NONE;
+ obj->type = OBJ_NONE;
obj->flags = 0;
memcpy(obj->sha1, sha1, 20);
if (!obj) {
union any_object *ret = xcalloc(1, sizeof(*ret));
created_object(sha1, &ret->object);
- ret->object.type = TYPE_NONE;
+ ret->object.type = OBJ_NONE;
return &ret->object;
}
return obj;
diff --git a/object.h b/object.h
index e0125e154fd970209d30138858f31ef2017651ac..733faac4ccd1c9a8bb4ed1fc67986b369d9442b3 100644 (file)
--- a/object.h
+++ b/object.h
#define TYPE_BITS 3
#define FLAG_BITS 27
-#define TYPE_NONE 0
-#define TYPE_BLOB 1
-#define TYPE_TREE 2
-#define TYPE_COMMIT 3
-#define TYPE_TAG 4
-#define TYPE_BAD 5
+/*
+ * The object type is stored in 3 bits.
+ */
+enum object_type {
+ OBJ_NONE = 0,
+ OBJ_COMMIT = 1,
+ OBJ_TREE = 2,
+ OBJ_BLOB = 3,
+ OBJ_TAG = 4,
+ /* 5/6 for future expansion */
+ OBJ_DELTA = 7,
+ OBJ_BAD,
+};
struct object {
unsigned parsed : 1;
};
extern int track_object_refs;
-extern const char *type_names[];
+extern const char *type_names[9];
extern unsigned int get_max_object_index(void);
extern struct object *get_indexed_object(unsigned int);
static inline const char *typename(unsigned int type)
{
- return type_names[type > TYPE_TAG ? TYPE_BAD : type];
+ return type_names[type > OBJ_BAD ? OBJ_BAD : type];
}
extern struct object_refs *lookup_object_refs(struct object *);
index 694e0c56f0b67c1ae9b7a94a243aca7b8859e50c..eb07b033ae54941d4bd00ee6bc30c7d50fd039b0 100644 (file)
--- a/pack.h
+++ b/pack.h
#ifndef PACK_H
#define PACK_H
-/*
- * The packed object type is stored in 3 bits.
- * The type value 0 is a reserved prefix if ever there is more than 7
- * object types, or any future format extensions.
- */
-enum object_type {
- OBJ_EXT = 0,
- OBJ_COMMIT = 1,
- OBJ_TREE = 2,
- OBJ_BLOB = 3,
- OBJ_TAG = 4,
- /* 5/6 for future expansion */
- OBJ_DELTA = 7,
-};
+#include "object.h"
/*
* Packed object header
diff --git a/revision.c b/revision.c
index 7df9089f530d5171dc267d95eed4cf90ea51ea69..874e349db818d52329e30f2634855e5cf14192b8 100644 (file)
--- a/revision.c
+++ b/revision.c
@@ -135,7 +135,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
/*
* Tag object? Look what it points to..
*/
- while (object->type == TYPE_TAG) {
+ while (object->type == OBJ_TAG) {
struct tag *tag = (struct tag *) object;
if (revs->tag_objects && !(flags & UNINTERESTING))
add_pending_object(revs, object, tag->tag);
@@ -148,7 +148,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
* Commit object? Just return it, we'll do all the complex
* reachability crud.
*/
- if (object->type == TYPE_COMMIT) {
+ if (object->type == OBJ_COMMIT) {
struct commit *commit = (struct commit *)object;
if (parse_commit(commit) < 0)
die("unable to parse commit %s", name);
@@ -164,7 +164,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
* Tree object? Either mark it uniniteresting, or add it
* to the list of objects to look at later..
*/
- if (object->type == TYPE_TREE) {
+ if (object->type == OBJ_TREE) {
struct tree *tree = (struct tree *)object;
if (!revs->tree_objects)
return NULL;
@@ -179,7 +179,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
/*
* Blob object? You know the drill by now..
*/
- if (object->type == TYPE_BLOB) {
+ if (object->type == OBJ_BLOB) {
struct blob *blob = (struct blob *)object;
if (!revs->blob_objects)
return NULL;
@@ -494,11 +494,11 @@ static int add_parents_only(struct rev_info *revs, const char *arg, int flags)
return 0;
while (1) {
it = get_reference(revs, arg, sha1, 0);
- if (it->type != TYPE_TAG)
+ if (it->type != OBJ_TAG)
break;
memcpy(sha1, ((struct tag*)it)->tagged->sha1, 20);
}
- if (it->type != TYPE_COMMIT)
+ if (it->type != OBJ_COMMIT)
return 0;
commit = (struct commit *)it;
for (parents = commit->parents; parents; parents = parents->next) {
diff --git a/send-pack.c b/send-pack.c
index 4019a4b98155841a9d335bc5a1ebdc7d114c5a4d..10bc8bc35935c6ba3af70456781d6194c55ba274 100644 (file)
--- a/send-pack.c
+++ b/send-pack.c
* old. Otherwise we require --force.
*/
o = deref_tag(parse_object(old_sha1), NULL, 0);
- if (!o || o->type != TYPE_COMMIT)
+ if (!o || o->type != OBJ_COMMIT)
return 0;
old = (struct commit *) o;
o = deref_tag(parse_object(new_sha1), NULL, 0);
- if (!o || o->type != TYPE_COMMIT)
+ if (!o || o->type != OBJ_COMMIT)
return 0;
new = (struct commit *) o;
diff --git a/server-info.c b/server-info.c
index fdfe05a2daeeb9253b6fb6a15518aba967821cb2..7df628f2b226f6984d168af0382680b9dae0751a 100644 (file)
--- a/server-info.c
+++ b/server-info.c
struct object *o = parse_object(sha1);
fprintf(info_ref_fp, "%s %s\n", sha1_to_hex(sha1), path);
- if (o->type == TYPE_TAG) {
+ if (o->type == OBJ_TAG) {
o = deref_tag(o, path, 0);
if (o)
fprintf(info_ref_fp, "%s %s^{}\n",
diff --git a/sha1_name.c b/sha1_name.c
index f2cbafa496231e7a9cdbbea2ab4e7d4c4ed761ab..5fe8e5d4bf25d79c3fa76610d1617ee07c1f1e2c 100644 (file)
--- a/sha1_name.c
+++ b/sha1_name.c
sp++; /* beginning of type name, or closing brace for empty */
if (!strncmp(commit_type, sp, 6) && sp[6] == '}')
- expected_type = TYPE_COMMIT;
+ expected_type = OBJ_COMMIT;
else if (!strncmp(tree_type, sp, 4) && sp[4] == '}')
- expected_type = TYPE_TREE;
+ expected_type = OBJ_TREE;
else if (!strncmp(blob_type, sp, 4) && sp[4] == '}')
- expected_type = TYPE_BLOB;
+ expected_type = OBJ_BLOB;
else if (sp[0] == '}')
- expected_type = TYPE_NONE;
+ expected_type = OBJ_NONE;
else
return -1;
memcpy(sha1, o->sha1, 20);
return 0;
}
- if (o->type == TYPE_TAG)
+ if (o->type == OBJ_TAG)
o = ((struct tag*) o)->tagged;
- else if (o->type == TYPE_COMMIT)
+ else if (o->type == OBJ_COMMIT)
o = &(((struct commit *) o)->tree->object);
else
return error("%.*s: expected %s type, but the object dereferences to %s type",
index 74d0dabe5d8c1f06a3f67475368c34e3b4046456..864ac1bb602b1af07301d0b5f15d31e904b343a6 100644 (file)
--- a/tag.c
+++ b/tag.c
struct object *deref_tag(struct object *o, const char *warn, int warnlen)
{
- while (o && o->type == TYPE_TAG)
+ while (o && o->type == OBJ_TAG)
o = parse_object(((struct tag *)o)->tagged->sha1);
if (!o && warn) {
if (!warnlen)
if (!obj) {
struct tag *ret = alloc_tag_node();
created_object(sha1, &ret->object);
- ret->object.type = TYPE_TAG;
+ ret->object.type = OBJ_TAG;
return ret;
}
if (!obj->type)
- obj->type = TYPE_TAG;
- if (obj->type != TYPE_TAG) {
+ obj->type = OBJ_TAG;
+ if (obj->type != OBJ_TAG) {
error("Object %s is a %s, not a tree",
sha1_to_hex(sha1), typename(obj->type));
return NULL;
index 10236555cc5c127b9b5b2cac8f2514c1b7e87676..a6032e35ecb2543b6efcae252e5815b804cb6f0a 100644 (file)
--- a/tree.c
+++ b/tree.c
if (!obj) {
struct tree *ret = alloc_tree_node();
created_object(sha1, &ret->object);
- ret->object.type = TYPE_TREE;
+ ret->object.type = OBJ_TREE;
return ret;
}
if (!obj->type)
- obj->type = TYPE_TREE;
- if (obj->type != TYPE_TREE) {
+ obj->type = OBJ_TREE;
+ if (obj->type != OBJ_TREE) {
error("Object %s is a %s, not a tree",
sha1_to_hex(sha1), typename(obj->type));
return NULL;
do {
if (!obj)
return NULL;
- if (obj->type == TYPE_TREE)
+ if (obj->type == OBJ_TREE)
return (struct tree *) obj;
- else if (obj->type == TYPE_COMMIT)
+ else if (obj->type == OBJ_COMMIT)
obj = &(((struct commit *) obj)->tree->object);
- else if (obj->type == TYPE_TAG)
+ else if (obj->type == OBJ_TAG)
obj = ((struct tag *) obj)->tagged;
else
return NULL;
diff --git a/upload-pack.c b/upload-pack.c
index b18eb9ba0dbe8b5020aaaa698d98a4d1b76aa49c..2e820c9c85cf750d57760251aa62237a5173c526 100644 (file)
--- a/upload-pack.c
+++ b/upload-pack.c
o = parse_object(sha1);
if (!o)
die("oops (%s)", sha1_to_hex(sha1));
- if (o->type == TYPE_COMMIT) {
+ if (o->type == OBJ_COMMIT) {
struct commit_list *parents;
if (o->flags & THEY_HAVE)
return 0;
o->flags |= OUR_REF;
nr_our_refs++;
}
- if (o->type == TYPE_TAG) {
+ if (o->type == OBJ_TAG) {
o = deref_tag(o, refname, 0);
packet_write(1, "%s %s^{}\n", sha1_to_hex(o->sha1), refname);
}