Signed-off-by: brian m. carlson <[email protected]>
---
bundle.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/bundle.c b/bundle.c
index 1222952..798ba28 100644
--- a/bundle.c
+++ b/bundle.c
@@ -11,11 +11,11 @@
static const char bundle_signature[] = "# v2 git bundle\n";
-static void add_to_ref_list(const unsigned char *sha1, const char *name,
+static void add_to_ref_list(const struct object_id *sha1, const char *name,
struct ref_list *list)
{
ALLOC_GROW(list->list, list->nr + 1, list->alloc);
- hashcpy(list->list[list->nr].sha1, sha1);
+ hashcpy(list->list[list->nr].sha1, sha1->oid);
list->list[list->nr].name = xstrdup(name);
list->nr++;
}
@@ -39,7 +39,7 @@ static int parse_bundle_header(int fd, struct bundle_header
*header,
/* The bundle header ends with an empty line */
while (!strbuf_getwholeline_fd(&buf, fd, '\n') &&
buf.len && buf.buf[0] != '\n') {
- unsigned char sha1[20];
+ struct object_id sha1;
int is_prereq = 0;
if (*buf.buf == '-') {
@@ -53,9 +53,9 @@ static int parse_bundle_header(int fd, struct bundle_header
*header,
* Prerequisites have object name that is optionally
* followed by SP and subject line.
*/
- if (get_sha1_hex(buf.buf, sha1) ||
- (buf.len > 40 && !isspace(buf.buf[40])) ||
- (!is_prereq && buf.len <= 40)) {
+ if (get_sha1_hex(buf.buf, sha1.oid) ||
+ (buf.len > GIT_OID_HEXSZ &&
!isspace(buf.buf[GIT_OID_HEXSZ])) ||
+ (!is_prereq && buf.len <= GIT_OID_HEXSZ)) {
if (report_path)
error(_("unrecognized header: %s%s (%d)"),
(is_prereq ? "-" : ""), buf.buf,
(int)buf.len);
@@ -63,9 +63,9 @@ static int parse_bundle_header(int fd, struct bundle_header
*header,
break;
} else {
if (is_prereq)
- add_to_ref_list(sha1, "",
&header->prerequisites);
+ add_to_ref_list(&sha1, "",
&header->prerequisites);
else
- add_to_ref_list(sha1, buf.buf + 41,
&header->references);
+ add_to_ref_list(&sha1, buf.buf + 41,
&header->references);
}
}
@@ -274,16 +274,16 @@ int create_bundle(struct bundle_header *header, const
char *path,
return -1;
rls_fout = xfdopen(rls.out, "r");
while (strbuf_getwholeline(&buf, rls_fout, '\n') != EOF) {
- unsigned char sha1[20];
+ struct object_id sha1;
if (buf.len > 0 && buf.buf[0] == '-') {
write_or_die(bundle_fd, buf.buf, buf.len);
- if (!get_sha1_hex(buf.buf + 1, sha1)) {
- struct object *object =
parse_object_or_die(sha1, buf.buf);
+ if (!get_sha1_hex(buf.buf + 1, sha1.oid)) {
+ struct object *object =
parse_object_or_die(sha1.oid, buf.buf);
object->flags |= UNINTERESTING;
add_pending_object(&revs, object, buf.buf);
}
- } else if (!get_sha1_hex(buf.buf, sha1)) {
- struct object *object = parse_object_or_die(sha1,
buf.buf);
+ } else if (!get_sha1_hex(buf.buf, sha1.oid)) {
+ struct object *object = parse_object_or_die(sha1.oid,
buf.buf);
object->flags |= SHOWN;
}
}
@@ -302,16 +302,16 @@ int create_bundle(struct bundle_header *header, const
char *path,
for (i = 0; i < revs.pending.nr; i++) {
struct object_array_entry *e = revs.pending.objects + i;
- unsigned char sha1[20];
+ struct object_id sha1;
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), sha1.oid, &ref) != 1)
continue;
- if (read_ref_full(e->name, sha1, 1, &flag))
+ if (read_ref_full(e->name, sha1.oid, 1, &flag))
flag = 0;
display_ref = (flag & REF_ISSYMREF) ? e->name : ref;
@@ -342,13 +342,13 @@ int create_bundle(struct bundle_header *header, const
char *path,
* commit that is referenced by the tag, and not the tag
* itself.
*/
- if (hashcmp(sha1, e->item->sha1)) {
+ if (hashcmp(sha1.oid, e->item->sha1)) {
/*
* 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(sha1.oid);
struct object *obj;
if (e->item == &(one->object)) {
@@ -360,7 +360,7 @@ int create_bundle(struct bundle_header *header, const char
*path,
* end up triggering "empty bundle"
* error.
*/
- obj = parse_object_or_die(sha1, e->name);
+ obj = parse_object_or_die(sha1.oid, e->name);
obj->flags |= SHOWN;
add_pending_object(&revs, obj, e->name);
}
--
2.0.0.rc0
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html