diff options
author | Christian Couder <christian.couder@gmail.com> | 2019-06-25 15:40:29 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-06-25 14:05:37 -0700 |
commit | 9cfebc1f3b2b60290b6321b95e5038b6e5b758ab (patch) | |
tree | 393cc21d066fc0fa79118121343304c6f7a013df /promisor-remote.c | |
parent | 9e27beaa2344dc6dd422d7711a666c082785118f (diff) | |
download | git-9cfebc1f3b2b60290b6321b95e5038b6e5b758ab.tar.gz |
promisor-remote: add promisor_remote_reinit()
We will need to reinitialize the promisor remote configuration
as we will make some changes to it in a later commit.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'promisor-remote.c')
-rw-r--r-- | promisor-remote.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/promisor-remote.c b/promisor-remote.c index b79a84ce3a..763d98aedd 100644 --- a/promisor-remote.c +++ b/promisor-remote.c @@ -67,10 +67,10 @@ static int promisor_remote_config(const char *var, const char *value, void *data return 0; } +static int initialized; + static void promisor_remote_init(void) { - static int initialized; - if (initialized) return; initialized = 1; @@ -78,6 +78,24 @@ static void promisor_remote_init(void) git_config(promisor_remote_config, NULL); } +static void promisor_remote_clear(void) +{ + while (promisors) { + struct promisor_remote *r = promisors; + promisors = promisors->next; + free(r); + } + + promisors_tail = &promisors; +} + +void promisor_remote_reinit(void) +{ + initialized = 0; + promisor_remote_clear(); + promisor_remote_init(); +} + struct promisor_remote *promisor_remote_find(const char *remote_name) { promisor_remote_init(); |