Re: [PATCH 1/6] sha1-file.c: remove the_repo from read_object_with_reference()
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 27, 2019, 12:54 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1906271448290.44@tvgsbejvaqbjf.bet>
- In-Reply-To
- <20190624095533.22162-2-pclouds@gmail.com>
Hi Duy,
On Mon, 24 Jun 2019, Nguyễn Thái Ngọc Duy wrote:
Show 11 quoted lines
> 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...
Show 9 quoted lines
> &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