Re: [PATCH 025/194] object-store: allow prepare_alt_odb to handle arbitrary repositories
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Feb 6, 2018, 13:44 UTC
- Message-ID
- <38759fdc-64df-113b-9cc9-03e49b5b6cb2@gmail.com>
- In-Reply-To
- <20180206011940.GD7904@genre.crustytoothpaste.net>
On 2/5/2018 8:19 PM, brian m. carlson wrote:
Show 13 quoted lines
> On Mon, Feb 05, 2018 at 03:54:46PM -0800, Stefan Beller wrote: >> @@ -434,12 +433,12 @@ static int link_alt_odb_entry_the_repository(const char *entry, >> ent = alloc_alt_odb(pathbuf.buf); >> >> /* add the alternate entry */ >> - *the_repository->objects.alt_odb_tail = ent; >> - the_repository->objects.alt_odb_tail = &(ent->next); >> + *r->objects.alt_odb_tail = ent; >> + r->objects.alt_odb_tail = &(ent->next); >> ent->next = NULL; > I'm sure I'm missing something obvious, but it's not clear to me that > this transformation is correct. Could you perhaps say a few words about > why it is?
I believe the reason it is correct is due to this change, higher up:
+static void read_info_alternates(struct repository *r, + const char *relative_base, + int depth);
Now the method takes a 'struct repository' pointer (which at this moment will always be the_repository) but it allows callers to use a different repository, when they are ready.
Thanks, -Stolee