Web lists-archives.com

[PATCH 127/194] alternates: convert add_to_alternates_memory to handle arbitrary repos




Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
---
 alternates.h | 3 +--
 sha1_file.c  | 7 +++----
 tmp-objdir.c | 1 +
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/alternates.h b/alternates.h
index e4520ae5c7..b3d8d57ba4 100644
--- a/alternates.h
+++ b/alternates.h
@@ -56,8 +56,7 @@ extern void add_to_alternates_file_the_repository(const char *dir);
  * recursive alternates it points to), but do not modify the on-disk alternates
  * file.
  */
-#define add_to_alternates_memory(r, d) add_to_alternates_memory_##r(d)
-extern void add_to_alternates_memory_the_repository(const char *dir);
+extern void add_to_alternates_memory(struct repository *r, const char *dir);
 
 /*
  * Returns a scratch strbuf pre-filled with the alternate object directory,
diff --git a/sha1_file.c b/sha1_file.c
index 743ada360d..3c39e34c72 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -581,16 +581,15 @@ void add_to_alternates_file_the_repository(const char *reference)
 	free(alts);
 }
 
-void add_to_alternates_memory_the_repository(const char *reference)
+void add_to_alternates_memory(struct repository *r, const char *reference)
 {
 	/*
 	 * Make sure alternates are initialized, or else our entry may be
 	 * overwritten when they are.
 	 */
-	prepare_alt_odb(the_repository);
+	prepare_alt_odb(r);
 
-	link_alt_odb_entries(the_repository, reference,
-			     '\n', NULL, 0);
+	link_alt_odb_entries(r, reference, '\n', NULL, 0);
 }
 
 /*
diff --git a/tmp-objdir.c b/tmp-objdir.c
index a9334d3fc5..acd55680c8 100644
--- a/tmp-objdir.c
+++ b/tmp-objdir.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "tmp-objdir.h"
 #include "alternates.h"
+#include "repository.h"
 #include "dir.h"
 #include "sigchain.h"
 #include "string-list.h"
-- 
2.15.1.433.g936d1b9894.dirty