diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2015-11-10 02:22:28 +0000 |
---|---|---|
committer | Jeff King <peff@peff.net> | 2015-11-20 08:02:05 -0500 |
commit | f2fd0760f62e79609fef7bfd7ecebb002e8e4ced (patch) | |
tree | 1f915114b015428730e95a89697783560b672008 /bundle.c | |
parent | 7999b2cf772956466baa8925491d6fb1b0963292 (diff) | |
download | git-f2fd0760f62e79609fef7bfd7ecebb002e8e4ced.tar.gz |
Convert struct object to object_id
struct object is one of the major data structures dealing with object
IDs. Convert it to use struct object_id instead of an unsigned char
array. Convert get_object_hash to refer to the new member as well.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'bundle.c')
-rw-r--r-- | bundle.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -171,7 +171,7 @@ int verify_bundle(struct bundle_header *header, int verbose) if (!(refs.objects[i].item->flags & SHOWN)) { if (++ret == 1) error("%s", message); - error("%s %s", sha1_to_hex(refs.objects[i].item->sha1), + error("%s %s", oid_to_hex(&refs.objects[i].item->oid), refs.objects[i].name); } @@ -256,7 +256,7 @@ static int write_pack_data(int bundle_fd, struct rev_info *revs) struct object *object = revs->pending.objects[i].item; if (object->flags & UNINTERESTING) write_or_die(pack_objects.in, "^", 1); - write_or_die(pack_objects.in, sha1_to_hex(object->sha1), 40); + write_or_die(pack_objects.in, oid_to_hex(&object->oid), GIT_SHA1_HEXSZ); write_or_die(pack_objects.in, "\n", 1); } close(pack_objects.in); @@ -321,16 +321,16 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs) for (i = 0; i < revs->pending.nr; i++) { struct object_array_entry *e = revs->pending.objects + i; - unsigned char sha1[20]; + struct object_id oid; char *ref; const char *display_ref; int flag; if (e->item->flags & UNINTERESTING) continue; - if (dwim_ref(e->name, strlen(e->name), sha1, &ref) != 1) + if (dwim_ref(e->name, strlen(e->name), oid.hash, &ref) != 1) goto skip_write_ref; - if (read_ref_full(e->name, RESOLVE_REF_READING, sha1, &flag)) + if (read_ref_full(e->name, RESOLVE_REF_READING, oid.hash, &flag)) flag = 0; display_ref = (flag & REF_ISSYMREF) ? e->name : ref; @@ -360,13 +360,13 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs) * commit that is referenced by the tag, and not the tag * itself. */ - if (hashcmp(sha1, e->item->sha1)) { + if (oidcmp(&oid, &e->item->oid)) { /* * Is this the positive end of a range expressed * in terms of a tag (e.g. v2.0 from the range * "v1.0..v2.0")? */ - struct commit *one = lookup_commit_reference(sha1); + struct commit *one = lookup_commit_reference(oid.hash); struct object *obj; if (e->item == &(one->object)) { @@ -378,7 +378,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs) * end up triggering "empty bundle" * error. */ - obj = parse_object_or_die(sha1, e->name); + obj = parse_object_or_die(oid.hash, e->name); obj->flags |= SHOWN; add_pending_object(revs, obj, e->name); } @@ -386,7 +386,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs) } ref_count++; - write_or_die(bundle_fd, sha1_to_hex(e->item->sha1), 40); + write_or_die(bundle_fd, oid_to_hex(&e->item->oid), 40); write_or_die(bundle_fd, " ", 1); write_or_die(bundle_fd, display_ref, strlen(display_ref)); write_or_die(bundle_fd, "\n", 1); |