[PATCH v4 5/9] remote-odb: add remote_odb_reinit()
From: Christian Couder <hidden>
Date: 2018-08-02 06:15:50
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Christian Couder <redacted> We will need to reinitialize the remote odb configuration as we will make some changes to it in a later commit when we will detect that a remote is also a remote odb. Signed-off-by: Christian Couder <redacted> Signed-off-by: Junio C Hamano <redacted> --- remote-odb.c | 14 ++++++++++++-- remote-odb.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/remote-odb.c b/remote-odb.c
index 09dfc2e16f..f063ba0fda 100644
--- a/remote-odb.c
+++ b/remote-odb.c@@ -64,17 +64,27 @@ static int remote_odb_config(const char *var, const char *value, void *data) return 0; } -static void remote_odb_init(void) +static void remote_odb_do_init(int force) { static int initialized; - if (initialized) + if (!force && initialized) return; initialized = 1; git_config(remote_odb_config, NULL); } +static inline void remote_odb_init(void) +{ + remote_odb_do_init(0); +} + +void remote_odb_reinit(void) +{ + remote_odb_do_init(1); +} + struct odb_helper *find_odb_helper(const char *remote) { remote_odb_init();
diff --git a/remote-odb.h b/remote-odb.h
index e10a8bf855..79803782af 100644
--- a/remote-odb.h
+++ b/remote-odb.h@@ -1,6 +1,7 @@ #ifndef REMOTE_ODB_H #define REMOTE_ODB_H +extern void remote_odb_reinit(void); extern struct odb_helper *find_odb_helper(const char *remote); extern int has_remote_odb(void); extern int remote_odb_get_direct(const unsigned char *sha1);
--
2.18.0.330.g17eb9fed90