Re: [PATCH 1/6] sha1-file.c: remove the_repo from read_object_with_reference()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Duy,

On Mon, 24 Jun 2019, Nguyễn Thái Ngọc Duy wrote:

> diff --git a/builtin/grep.c b/builtin/grep.c
> index 580fd38f41..85da7ee542 100644
> --- a/builtin/grep.c
> +++ b/builtin/grep.c
> @@ -458,7 +458,8 @@ static int grep_submodule(struct grep_opt *opt,
>  		object = parse_object_or_die(oid, oid_to_hex(oid));
>
>  		grep_read_lock();
> -		data = read_object_with_reference(&object->oid, tree_type,
> +		data = read_object_with_reference(opt->repo,
> +						  &object->oid, tree_type,

Junio's hunch was absolutely spot on. This conversion is incorrect. If you
replace this `opt->repo` and...

>  						  &size, NULL);
>  		grep_read_unlock();
>
> @@ -623,7 +624,8 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
>  		int hit, len;
>
>  		grep_read_lock();
> -		data = read_object_with_reference(&obj->oid, tree_type,
> +		data = read_object_with_reference(opt->repo,

... this one with `the_repository`, t7814 starts passing again.

It makes me very wary of this patch series that this bug has only been
caught by a CI build. You probably did not run the test suite before
sending this patch series.

I also wonder what the rationale was to deviate from the strategy used in
the remainder of the call sites, where no attempt was made to use an
already-available repository pointer that might, or might not, be the
correct one.

It strikes me as a pretty important goal of this patch series to _not_
change any behavior, and this bug makes me dubious that all diligence has
been done to assure that.

Ciao,
Johannes

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux