Re: [PATCH 10/35] commit: add repository argument to lookup_commit
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jun 14, 2018, 16:22 UTC
- Message-ID
- <CACsJy8D2JbeWvBg9F69tAJgq1874=ROFBG-QKfCHeUMZwcY-VQ@mail.gmail.com>
- In-Reply-To
- <20180530004810.30076-11-sbeller@google.com>
On Wed, May 30, 2018 at 2:51 AM Stefan Beller <sbeller@google.com> wrote:
Show 10 quoted lines
> diff --git a/shallow.c b/shallow.c
> index 9bb07a56dca..60fe1fe1e58 100644
> --- a/shallow.c
> +++ b/shallow.c
> @@ -31,7 +31,7 @@ int register_shallow(struct repository *r, const struct object_id *oid)
> {
> struct commit_graft *graft =
> xmalloc(sizeof(struct commit_graft));
> - struct commit *commit = lookup_commit(oid);
> + struct commit *commit = lookup_commit(the_repository, oid);This looks wrong. register_shallow() has struct repository argument 'r' and it should be used here instead.
If this is a mechanical conversion, I will also be happy that the switch from the_repo to r is done in a separate patch.
FYI I noticed this because I'm in a quest to kill the_index by passing 'struct index_state *' throughout library code, and sometimes I pass 'struct repository *' instead when I see that code uses more things that just the index. And I have started to replace the_repository in some places with a function argument.
If some of my patches come first while you have not finished repository conversion (very likely), you and I will have to pay attention to this more often.
-- Duy