Web lists-archives.com

Re: [PATCH 025/194] object-store: allow prepare_alt_odb to handle arbitrary repositories




On 2/5/2018 8:19 PM, brian m. carlson wrote:
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