summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-08-29 23:58:02 -0700
committerJunio C Hamano <gitster@pobox.com>2017-09-07 08:49:44 +0900
commit8873f87644f78c37456f181bef1c784444a7eb08 (patch)
tree251bc8a9e5629981911d1952437db114593564de
parent5a6e14123648046b23a25ee415148cee06c3199c (diff)
downloadgit-8873f87644f78c37456f181bef1c784444a7eb08.tar.gz
sha1_file: add repository argument to read_info_alternates
Add a repository argument to allow the read_info_alternates caller to be more specific about which repository to read from. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commit, use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--sha1_file.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sha1_file.c b/sha1_file.c
index c63b52f6fa..29cead6d2c 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -323,7 +323,9 @@ static int alt_odb_usable_the_repository(struct strbuf *path,
* SHA1, an extra slash for the first level indirection, and the
* terminating NUL.
*/
-static void read_info_alternates(const char * relative_base, int depth);
+#define read_info_alternates(r, rb, d) read_info_alternates_##r(rb, d)
+static void read_info_alternates_the_repository(const char *relative_base,
+ int depth);
#define link_alt_odb_entry(r, e, rb, d, n) link_alt_odb_entry_##r(e, rb, d, n)
static int link_alt_odb_entry_the_repository(const char *entry,
const char *relative_base, int depth, const char *normalized_objdir)
@@ -364,7 +366,7 @@ static int link_alt_odb_entry_the_repository(const char *entry,
ent->next = NULL;
/* recursively add alternates */
- read_info_alternates(pathbuf.buf, depth + 1);
+ read_info_alternates(the_repository, pathbuf.buf, depth + 1);
strbuf_release(&pathbuf);
return 0;
@@ -427,7 +429,8 @@ static void link_alt_odb_entries(const char *alt, int len, int sep,
strbuf_release(&objdirbuf);
}
-static void read_info_alternates(const char * relative_base, int depth)
+static void read_info_alternates_the_repository(const char *relative_base,
+ int depth)
{
char *map;
size_t mapsz;
@@ -624,7 +627,7 @@ void prepare_alt_odb(void)
&the_repository->objects.alt_odb_list;
link_alt_odb_entries(alt, strlen(alt), PATH_SEP, NULL, 0);
- read_info_alternates(get_object_directory(), 0);
+ read_info_alternates(the_repository, get_object_directory(), 0);
}
/* Returns 1 if we have successfully freshened the file, 0 otherwise. */