aboutsummaryrefslogtreecommitdiff
path: root/bundle.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-05-06 22:10:38 +0000
committerJunio C Hamano <gitster@pobox.com>2017-05-08 15:12:58 +0900
commitc251c83df276dc0bff4d008433268ad59b7a8df2 (patch)
treed02e5ce126a0b10e1213b56278aff74a3e2a4b0f /bundle.c
parenta9dbc179100b7119cb44eb5b4adcb47967f346a6 (diff)
downloadgit-c251c83df276dc0bff4d008433268ad59b7a8df2.tar.gz
git-c251c83df276dc0bff4d008433268ad59b7a8df2.tar.xz
object: convert parse_object* to take struct object_id
Make parse_object, parse_object_or_die, and parse_object_buffer take a pointer to struct object_id. Remove the temporary variables inserted earlier, since they are no longer necessary. Transform all of the callers using the following semantic patch: @@ expression E1; @@ - parse_object(E1.hash) + parse_object(&E1) @@ expression E1; @@ - parse_object(E1->hash) + parse_object(E1) @@ expression E1, E2; @@ - parse_object_or_die(E1.hash, E2) + parse_object_or_die(&E1, E2) @@ expression E1, E2; @@ - parse_object_or_die(E1->hash, E2) + parse_object_or_die(E1, E2) @@ expression E1, E2, E3, E4, E5; @@ - parse_object_buffer(E1.hash, E2, E3, E4, E5) + parse_object_buffer(&E1, E2, E3, E4, E5) @@ expression E1, E2, E3, E4, E5; @@ - parse_object_buffer(E1->hash, E2, E3, E4, E5) + parse_object_buffer(E1, E2, E3, E4, E5) Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bundle.c')
-rw-r--r--bundle.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bundle.c b/bundle.c
index 3386dba3b..f4abac467 100644
--- a/bundle.c
+++ b/bundle.c
@@ -142,7 +142,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
init_revisions(&revs, NULL);
for (i = 0; i < p->nr; i++) {
struct ref_list_entry *e = p->list + i;
- struct object *o = parse_object(e->oid.hash);
+ struct object *o = parse_object(&e->oid);
if (o) {
o->flags |= PREREQ_MARK;
add_pending_object(&revs, o, e->name);
@@ -290,12 +290,14 @@ static int compute_and_write_prerequisites(int bundle_fd,
if (buf.len > 0 && buf.buf[0] == '-') {
write_or_die(bundle_fd, buf.buf, buf.len);
if (!get_oid_hex(buf.buf + 1, &oid)) {
- struct object *object = parse_object_or_die(oid.hash, buf.buf);
+ struct object *object = parse_object_or_die(&oid,
+ buf.buf);
object->flags |= UNINTERESTING;
add_pending_object(revs, object, buf.buf);
}
} else if (!get_oid_hex(buf.buf, &oid)) {
- struct object *object = parse_object_or_die(oid.hash, buf.buf);
+ struct object *object = parse_object_or_die(&oid,
+ buf.buf);
object->flags |= SHOWN;
}
}
@@ -379,7 +381,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
* end up triggering "empty bundle"
* error.
*/
- obj = parse_object_or_die(oid.hash, e->name);
+ obj = parse_object_or_die(&oid, e->name);
obj->flags |= SHOWN;
add_pending_object(revs, obj, e->name);
}