THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

daemon.c: replace `git_config()` with `git_config_get_bool()` family

Use `git_config_get_bool()` family instead of `git_config()` to take advantage of
the config-set API which provides a cleaner control flow.

Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tags/v2.2.0-rc0
Tanay Abhra Junio C Hamano 5 years ago
parent
commit
8939d32d81
1 changed files with 4 additions and 22 deletions
  1. +4
    -22
      daemon.c

+ 4
- 22
daemon.c View File

@@ -230,23 +230,6 @@ struct daemon_service {
int overridable;
};

static struct daemon_service *service_looking_at;
static int service_enabled;

static int git_daemon_config(const char *var, const char *value, void *cb)
{
const char *service;

if (skip_prefix(var, "daemon.", &service) &&
!strcmp(service, service_looking_at->config_name)) {
service_enabled = git_config_bool(var, value);
return 0;
}

/* we are not interested in parsing any other configuration here */
return 0;
}

static int daemon_error(const char *dir, const char *msg)
{
if (!informative_errors)
@@ -324,6 +307,7 @@ static int run_service(const char *dir, struct daemon_service *service)
{
const char *path;
int enabled = service->enabled;
struct strbuf var = STRBUF_INIT;

loginfo("Request %s for '%s'", service->name, dir);

@@ -354,11 +338,9 @@ static int run_service(const char *dir, struct daemon_service *service)
}

if (service->overridable) {
service_looking_at = service;
service_enabled = -1;
git_config(git_daemon_config, NULL);
if (0 <= service_enabled)
enabled = service_enabled;
strbuf_addf(&var, "daemon.%s", service->config_name);
git_config_get_bool(var.buf, &enabled);
strbuf_release(&var);
}
if (!enabled) {
logerror("'%s': service not enabled for '%s'",


Loading…
Cancel
Save