As we will need to reinitialize the list of odb helpers from the config file, let's add external_odb_reinit() for that purpose. Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx> --- external-odb.c | 14 ++++++++++++-- external-odb.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/external-odb.c b/external-odb.c index 9c77180d6c..82ac80aa04 100644 --- a/external-odb.c +++ b/external-odb.c @@ -39,17 +39,27 @@ static int external_odb_config(const char *var, const char *value, void *data) return 0; } -static void external_odb_init(void) +static void external_odb_do_init(int force) { static int initialized; - if (initialized || !use_external_odb) + if ((!force && initialized) || !use_external_odb) return; initialized = 1; git_config(external_odb_config, NULL); } +static inline void external_odb_init(void) +{ + external_odb_do_init(0); +} + +inline void external_odb_reinit(void) +{ + external_odb_do_init(1); +} + int has_external_odb(void) { external_odb_init(); diff --git a/external-odb.h b/external-odb.h index 27c3d39c1b..254070994a 100644 --- a/external-odb.h +++ b/external-odb.h @@ -9,6 +9,7 @@ enum odb_helper_type { OBJ_HELPER_MAX }; +extern void external_odb_reinit(void); extern int has_external_odb(void); extern struct odb_helper *find_odb_helper(const char *dealer, enum odb_helper_type type); -- 2.17.0.rc0.37.g8f476fabe9