mbox series

[v6,0/4] Don't lazy-fetch commits when parsing them

Message ID cover.1671045259.git.jonathantanmy@google.com (mailing list archive)
Headers show
Series Don't lazy-fetch commits when parsing them | expand

Message

Jonathan Tan Dec. 14, 2022, 7:17 p.m. UTC
Thanks everyone once again and sorry for the churn. Hopefully I got it
right this time.

open_loose_object() is documented to return the path of the object
we found, so I think we already have that covered (if we detect that
an object is corrupt, it follows that we would already have found the
object in the first place).

Jonathan Tan (4):
  object-file: remove OBJECT_INFO_IGNORE_LOOSE
  object-file: refactor map_loose_object_1()
  object-file: emit corruption errors when detected
  commit: don't lazy-fetch commits

 commit.c       |  15 ++++++-
 object-file.c  | 108 ++++++++++++++++++++++++-------------------------
 object-store.h |   7 ++--
 3 files changed, 69 insertions(+), 61 deletions(-)

Range-diff against v5:
1:  be0b08cac2 = 1:  be0b08cac2 object-file: remove OBJECT_INFO_IGNORE_LOOSE
2:  4b2fb68743 = 2:  4b2fb68743 object-file: refactor map_loose_object_1()
3:  a229ea0b11 ! 3:  811620909a object-file: emit corruption errors when detected
    @@ object-file.c: static int loose_object_info(struct repository *r,
      	int status = 0;
     +	int fd;
      	unsigned long mapsize;
    -+	const char *path = NULL;
    ++	const char *path;
      	void *map;
      	git_zstream stream;
      	char hdr[MAX_HEADER_LEN];
    @@ object-file.c: static int loose_object_info(struct repository *r,
      		break;
      	}
      
    -+	if (status && path && (flags & OBJECT_INFO_DIE_IF_CORRUPT))
    ++	if (status && (flags & OBJECT_INFO_DIE_IF_CORRUPT))
     +		die(_("loose object %s (stored in %s) is corrupt"),
     +		    oid_to_hex(oid), path);
     +
4:  b54972118a = 4:  8acf1a29e7 commit: don't lazy-fetch commits

Comments

Jeff King Dec. 14, 2022, 8:43 p.m. UTC | #1
On Wed, Dec 14, 2022 at 11:17:39AM -0800, Jonathan Tan wrote:

> Thanks everyone once again and sorry for the churn. Hopefully I got it
> right this time.
> 
> open_loose_object() is documented to return the path of the object
> we found, so I think we already have that covered (if we detect that
> an object is corrupt, it follows that we would already have found the
> object in the first place).

This version looks good to me. Thanks for your persistence. :) I think
the end result is very nicely done.

-Peff
Junio C Hamano Dec. 15, 2022, 12:07 a.m. UTC | #2
Jeff King <peff@peff.net> writes:

> On Wed, Dec 14, 2022 at 11:17:39AM -0800, Jonathan Tan wrote:
>
>> Thanks everyone once again and sorry for the churn. Hopefully I got it
>> right this time.
>> 
>> open_loose_object() is documented to return the path of the object
>> we found, so I think we already have that covered (if we detect that
>> an object is corrupt, it follows that we would already have found the
>> object in the first place).
>
> This version looks good to me. Thanks for your persistence. :) I think
> the end result is very nicely done.

Yeah, this looks good.  Nothing added to or removed from the
previous round other than what I found questionable during the
review of that round.

Thanks, both.