diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-05-05 19:15:39 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-05-05 19:15:39 -0700 |
commit | dc484f2213a34ced5abe5eb968650035204b6035 (patch) | |
tree | 1e1d0d7563cc91bd52ffcb895b9f21a0ed2607c8 /remote.c | |
parent | 2b3e60c245684fd68bab36c07fee9888ff24f4b4 (diff) | |
parent | 84bb2dfd9f4873c9ca19537efe62219b09ec03bf (diff) | |
download | git-dc484f2213a34ced5abe5eb968650035204b6035.tar.gz |
Merge branch 'pb/remote-mirror-config'
* pb/remote-mirror-config:
Add a remote.*.mirror configuration option
Diffstat (limited to 'remote.c')
-rw-r--r-- | remote.c | 53 |
1 files changed, 29 insertions, 24 deletions
@@ -337,44 +337,49 @@ static int handle_config(const char *key, const char *value) return 0; } remote = make_remote(name, subkey - name); - if (!value) { - /* if we ever have a boolean variable, e.g. "remote.*.disabled" - * [remote "frotz"] - * disabled - * is a valid way to set it to true; we get NULL in value so - * we need to handle it here. - * - * if (!strcmp(subkey, ".disabled")) { - * val = git_config_bool(key, value); - * return 0; - * } else - * - */ - return 0; /* ignore unknown booleans */ - } - if (!strcmp(subkey, ".url")) { - add_url(remote, xstrdup(value)); + if (!strcmp(subkey, ".mirror")) + remote->mirror = git_config_bool(key, value); + else if (!strcmp(subkey, ".skipdefaultupdate")) + remote->skip_default_update = git_config_bool(key, value); + + else if (!strcmp(subkey, ".url")) { + const char *v; + if (git_config_string(&v, key, value)) + return -1; + add_url(remote, v); } else if (!strcmp(subkey, ".push")) { - add_push_refspec(remote, xstrdup(value)); + const char *v; + if (git_config_string(&v, key, value)) + return -1; + add_push_refspec(remote, v); } else if (!strcmp(subkey, ".fetch")) { - add_fetch_refspec(remote, xstrdup(value)); + const char *v; + if (git_config_string(&v, key, value)) + return -1; + add_fetch_refspec(remote, v); } else if (!strcmp(subkey, ".receivepack")) { + const char *v; + if (git_config_string(&v, key, value)) + return -1; if (!remote->receivepack) - remote->receivepack = xstrdup(value); + remote->receivepack = v; else error("more than one receivepack given, using the first"); } else if (!strcmp(subkey, ".uploadpack")) { + const char *v; + if (git_config_string(&v, key, value)) + return -1; if (!remote->uploadpack) - remote->uploadpack = xstrdup(value); + remote->uploadpack = v; else error("more than one uploadpack given, using the first"); } else if (!strcmp(subkey, ".tagopt")) { if (!strcmp(value, "--no-tags")) remote->fetch_tags = -1; } else if (!strcmp(subkey, ".proxy")) { - remote->http_proxy = xstrdup(value); - } else if (!strcmp(subkey, ".skipdefaultupdate")) - remote->skip_default_update = 1; + return git_config_string((const char **)&remote->http_proxy, + key, value); + } return 0; } |