From: Michael Haggerty <mhagger@alum.mit.edu>
To: "brian m. carlson" <sandals@crustytoothpaste.net>, git@vger.kernel.org
Subject: Re: [PATCH 7/9] bundle.c: convert leaf functions to struct object_id
Date: Tue, 06 May 2014 16:42:16 +0200 [thread overview]
Message-ID: <5368F4C8.2060604@alum.mit.edu> (raw)
In-Reply-To: <1399147942-165308-8-git-send-email-sandals@crustytoothpaste.net>
On 05/03/2014 10:12 PM, brian m. carlson wrote:
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
> 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);
I think that 41 here is GIT_OID_HEXSZ + 1.
> [...]
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
next prev parent reply other threads:[~2014-05-06 16:45 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-03 20:12 [RFC PATCH 0/9] Use a structure for object IDs brian m. carlson
2014-05-03 20:12 ` [PATCH 1/9] Define " brian m. carlson
2014-05-04 6:07 ` Michael Haggerty
2014-05-04 9:21 ` Johannes Sixt
2014-05-04 9:43 ` David Kastrup
2014-05-04 10:55 ` Andreas Schwab
2014-05-04 20:18 ` Johannes Sixt
2014-05-04 21:31 ` Andreas Schwab
2014-05-05 5:19 ` David Kastrup
2014-05-05 9:23 ` Andreas Schwab
2014-05-05 9:33 ` James Denholm
2014-05-05 9:50 ` David Kastrup
2014-05-05 10:52 ` Michael Haggerty
2014-05-05 11:05 ` Andreas Schwab
2014-05-05 11:23 ` David Kastrup
2014-05-05 18:16 ` Felipe Contreras
2014-05-04 12:29 ` Duy Nguyen
2014-05-04 16:07 ` brian m. carlson
2014-05-04 16:48 ` Andreas Schwab
2014-05-04 17:07 ` David Kastrup
2014-05-04 17:24 ` Andreas Schwab
2014-05-04 17:44 ` David Kastrup
2014-05-04 18:01 ` Andreas Schwab
2014-05-03 20:12 ` [PATCH 2/9] bisect.c: convert to use struct object_id brian m. carlson
2014-05-03 20:12 ` [PATCH 3/9] archive.c: " brian m. carlson
2014-05-03 20:12 ` [PATCH 4/9] zip: use GIT_OID_HEXSZ for trailers brian m. carlson
2014-05-03 20:12 ` [PATCH 5/9] branch.c: convert to use struct object_id brian m. carlson
2014-05-03 20:12 ` [PATCH 6/9] bulk-checkin.c: " brian m. carlson
2014-05-03 20:12 ` [PATCH 7/9] bundle.c: convert leaf functions to " brian m. carlson
2014-05-06 14:42 ` Michael Haggerty [this message]
2014-05-03 20:12 ` [PATCH 8/9] cache-tree: convert struct cache_tree to use object_id brian m. carlson
2014-05-06 14:53 ` Michael Haggerty
2014-05-06 15:02 ` Michael Haggerty
2014-05-03 20:12 ` [PATCH 9/9] diff: convert struct combine_diff_path to object_id brian m. carlson
2014-05-06 15:08 ` Michael Haggerty
2014-05-03 22:49 ` [RFC PATCH 0/9] Use a structure for object IDs brian m. carlson
2014-05-04 6:35 ` Michael Haggerty
2014-05-04 9:19 ` Johannes Sixt
2014-05-04 17:54 ` brian m. carlson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5368F4C8.2060604@alum.mit.edu \
--to=mhagger@alum.mit.edu \
--cc=git@vger.kernel.org \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.