sha1_file: add repository argument to link_alt_odb_entries
See previous patch for explanation. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Mar 23, 2018 at 18:21 UTC
93d8d1e29d635741cc1a95c337d2a51dee0dcdf1
1 file changed
+13
-6
sha1_file.c
+13
-6
@@ -468,8 +468,12 @@ static const char *parse_alt_odb_entry(const char *string,
468
return end;
469
}
470
471
-static void link_alt_odb_entries(const char *alt, int sep,
472
- const char *relative_base, int depth)
471
+#define link_alt_odb_entries(r, a, s, rb, d) \
472
+ link_alt_odb_entries_##r(a, s, rb, d)
473
+static void link_alt_odb_entries_the_repository(const char *alt,
474
+ int sep,
475
+ const char *relative_base,
476
+ int depth)
477
{
478
struct strbuf objdirbuf = STRBUF_INIT;
479
struct strbuf entry = STRBUF_INIT;
@@ -512,7 +516,7 @@ static void read_info_alternates_the_repository(const char *relative_base,
516
return;
517
}
518
515
- link_alt_odb_entries(buf.buf, '\n', relative_base, depth);
519
+ link_alt_odb_entries(the_repository, buf.buf, '\n', relative_base, depth);
520
strbuf_release(&buf);
521
free(path);
522
}
@@ -566,7 +570,8 @@ void add_to_alternates_file(const char *reference)
570
if (commit_lock_file(&lock))
571
die_errno("unable to move new alternates file into place");
572
if (the_repository->objects->alt_odb_tail)
569
- link_alt_odb_entries(reference, '\n', NULL, 0);
573
+ link_alt_odb_entries(the_repository, reference,
574
+ '\n', NULL, 0);
575
}
576
free(alts);
577
}
@@ -579,7 +584,8 @@ void add_to_alternates_memory(const char *reference)
584
*/
585
prepare_alt_odb();
586
582
- link_alt_odb_entries(reference, '\n', NULL, 0);
587
+ link_alt_odb_entries(the_repository, reference,
588
+ '\n', NULL, 0);
589
}
590
591
/*
@@ -678,7 +684,8 @@ void prepare_alt_odb(void)
684
685
the_repository->objects->alt_odb_tail =
686
&the_repository->objects->alt_odb_list;
681
- link_alt_odb_entries(the_repository->objects->alternate_db,
687
+ link_alt_odb_entries(the_repository,
688
+ the_repository->objects->alternate_db,
689
PATH_SEP, NULL, 0);
690
691
read_info_alternates(the_repository, get_object_directory(), 0);