summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0bdf93c)
raw | patch | inline | side by side (parent: 0bdf93c)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Wed, 14 May 2008 17:46:53 +0000 (18:46 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 14 May 2008 19:34:44 +0000 (12:34 -0700) |
git_config() only had a function parameter, but no callback data
parameter. This assumes that all callback functions only modify
global variables.
With this patch, every callback gets a void * parameter, and it is hoped
that this will help the libification effort.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
parameter. This assumes that all callback functions only modify
global variables.
With this patch, every callback gets a void * parameter, and it is hoped
that this will help the libification effort.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
74 files changed:
index 116cac87c37eea27b9fc7aa41c5889fbf66057a5..995f3e6a0ac84fa71c3196de6673225d4a5d8231 100644 (file)
--- a/alias.c
+++ b/alias.c
static const char *alias_key;
static char *alias_val;
-static int alias_lookup_cb(const char *k, const char *v)
+
+static int alias_lookup_cb(const char *k, const char *v, void *cb)
{
if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) {
if (!v)
{
alias_key = alias;
alias_val = NULL;
- git_config(alias_lookup_cb);
+ git_config(alias_lookup_cb, NULL);
return alias_val;
}
diff --git a/archive-tar.c b/archive-tar.c
index 4add80284e4570d1da44861e9025fa75eeb775d6..d7598f907d9f7fb40c24c8cef815f8fc33a8b19b 100644 (file)
--- a/archive-tar.c
+++ b/archive-tar.c
strbuf_release(&ext_header);
}
-static int git_tar_config(const char *var, const char *value)
+static int git_tar_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "tar.umask")) {
if (value && !strcmp(value, "user")) {
}
return 0;
}
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
static int write_tar_entry(const unsigned char *sha1,
{
int plen = args->base ? strlen(args->base) : 0;
- git_config(git_tar_config);
+ git_config(git_tar_config, NULL);
archive_time = args->time;
verbose = args->verbose;
diff --git a/builtin-add.c b/builtin-add.c
index 4a91e3eb118850882fbc22e8d8f37e8bbfaa7617..15def7dada1b7266d0d6fe44da3f9c722f402463 100644 (file)
--- a/builtin-add.c
+++ b/builtin-add.c
if (add_interactive)
exit(interactive_add(argc, argv, prefix));
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
newfd = hold_locked_index(&lock_file, 1);
diff --git a/builtin-apply.c b/builtin-apply.c
index 1103625a4a923d92ca8d335d1a872236630541e5..bbdf08a10a35b9c6263cb1e899381d40d7b51e57 100644 (file)
--- a/builtin-apply.c
+++ b/builtin-apply.c
return 0;
}
-static int git_apply_config(const char *var, const char *value)
+static int git_apply_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "apply.whitespace"))
return git_config_string(&apply_default_whitespace, var, value);
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
prefix = setup_git_directory_gently(&is_not_gitdir);
prefix_length = prefix ? strlen(prefix) : 0;
- git_config(git_apply_config);
+ git_config(git_apply_config, NULL);
if (apply_default_whitespace)
parse_whitespace_option(apply_default_whitespace);
diff --git a/builtin-blame.c b/builtin-blame.c
index bfd562d7d2b897ad4ab3d35dda33701e315b7d5d..b451f6c64dde8ce6358bb5c8dfccc8bad181a6bb 100644 (file)
--- a/builtin-blame.c
+++ b/builtin-blame.c
usage(blame_usage);
}
-static int git_blame_config(const char *var, const char *value)
+static int git_blame_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "blame.showroot")) {
show_root = git_config_bool(var, value);
blank_boundary = git_config_bool(var, value);
return 0;
}
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
static struct commit *fake_working_tree_commit(const char *path, const char *contents_from)
cmd_is_annotate = !strcmp(argv[0], "annotate");
- git_config(git_blame_config);
+ git_config(git_blame_config, NULL);
save_commit_buffer = 0;
opt = 0;
diff --git a/builtin-branch.c b/builtin-branch.c
index 19c508a60827c9c7c744da995bf5737733864a76..d279702ba9a90faa020fa2f102d595cec082be21 100644 (file)
--- a/builtin-branch.c
+++ b/builtin-branch.c
die("bad config variable '%s'", var);
}
-static int git_branch_config(const char *var, const char *value)
+static int git_branch_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "color.branch")) {
branch_use_color = git_config_colorbool(var, value, -1);
color_parse(value, var, branch_colors[slot]);
return 0;
}
- return git_color_default_config(var, value);
+ return git_color_default_config(var, value, cb);
}
static const char *branch_get_color(enum color_branch ix)
OPT_END(),
};
- git_config(git_branch_config);
+ git_config(git_branch_config, NULL);
if (branch_use_color == -1)
branch_use_color = git_use_color_default;
diff --git a/builtin-cat-file.c b/builtin-cat-file.c
index f132d583d3e2a2ac0fe696b66723c846902d0a19..b488fad431d10a1e93f02cdcf075109430c96390 100644 (file)
--- a/builtin-cat-file.c
+++ b/builtin-cat-file.c
int opt;
const char *exp_type, *obj_name;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
if (argc != 3)
usage("git-cat-file [-t|-s|-e|-p|<type>] <sha1>");
exp_type = argv[1];
index 7e42024c67a2c0fda72f94935b7d5a723c73d131..eb1fc9aa6f7f61a817a198feaf94ca9d983eb14b 100644 (file)
--- a/builtin-checkout-index.c
+++ b/builtin-checkout-index.c
int read_from_stdin = 0;
int prefix_length;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
state.base_dir = "";
prefix_length = prefix ? strlen(prefix) : 0;
diff --git a/builtin-checkout.c b/builtin-checkout.c
index 10ec137ccec7d7f281562817d81a1035c4aa6124..c077134e62e92dc6eabb0bffc83974f5d79caa76 100644 (file)
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
memset(&opts, 0, sizeof(opts));
memset(&new, 0, sizeof(new));
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
opts.track = git_branch_track;
diff --git a/builtin-clean.c b/builtin-clean.c
index 6778a03ae4c901d216e4b91cd41f2073e0e98589..80a7ff9ae45035b44bbac44a9436152645c4fb38 100644 (file)
--- a/builtin-clean.c
+++ b/builtin-clean.c
NULL
};
-static int git_clean_config(const char *var, const char *value)
+static int git_clean_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "clean.requireforce"))
force = !git_config_bool(var, value);
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
int cmd_clean(int argc, const char **argv, const char *prefix)
OPT_END()
};
- git_config(git_clean_config);
+ git_config(git_clean_config, NULL);
if (force < 0)
force = 0;
else
diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c
index 6610d18358bae81ac1f162ca0c71062d36664c2a..e5e4bdbe862b23aafe932da411f597b0f3b5c997 100644 (file)
--- a/builtin-commit-tree.c
+++ b/builtin-commit-tree.c
struct strbuf buffer;
int encoding_is_utf8;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
if (argc < 2)
usage(commit_tree_usage);
diff --git a/builtin-commit.c b/builtin-commit.c
index a65c2b8c37c2f7785d76ec1f4e3692ee52dab8e9..9f0026ed00f4413df1ea6db472273ae03cb1ab91 100644 (file)
--- a/builtin-commit.c
+++ b/builtin-commit.c
const char *index_file;
int commitable;
- git_config(git_status_config);
+ git_config(git_status_config, NULL);
if (wt_status_use_color == -1)
wt_status_use_color = git_use_color_default;
}
}
-int git_commit_config(const char *k, const char *v)
+int git_commit_config(const char *k, const char *v, void *cb)
{
if (!strcmp(k, "commit.template")) {
if (!v)
return 0;
}
- return git_status_config(k, v);
+ return git_status_config(k, v, cb);
}
static const char commit_utf8_warn[] =
unsigned char commit_sha1[20];
struct ref_lock *ref_lock;
- git_config(git_commit_config);
+ git_config(git_commit_config, NULL);
argc = parse_and_validate_options(argc, argv, builtin_commit_usage);
diff --git a/builtin-config.c b/builtin-config.c
index 8ee01bdecde1ede4062a630761ce56f3366f3a14..3a441ef64868b7c477ee9c49546ef1cb39e5acad 100644 (file)
--- a/builtin-config.c
+++ b/builtin-config.c
static char term = '\n';
static enum { T_RAW, T_INT, T_BOOL, T_BOOL_OR_INT } type = T_RAW;
-static int show_all_config(const char *key_, const char *value_)
+static int show_all_config(const char *key_, const char *value_, void *cb)
{
if (value_)
printf("%s%c%s%c", key_, delim, value_, term);
return 0;
}
-static int show_config(const char* key_, const char* value_)
+static int show_config(const char* key_, const char* value_, void *cb)
{
char value[256];
const char *vptr = value;
}
if (do_all && system_wide)
- git_config_from_file(show_config, system_wide);
+ git_config_from_file(show_config, system_wide, NULL);
if (do_all && global)
- git_config_from_file(show_config, global);
- git_config_from_file(show_config, local);
+ git_config_from_file(show_config, global, NULL);
+ git_config_from_file(show_config, local, NULL);
if (!do_all && !seen && global)
- git_config_from_file(show_config, global);
+ git_config_from_file(show_config, global, NULL);
if (!do_all && !seen && system_wide)
- git_config_from_file(show_config, system_wide);
+ git_config_from_file(show_config, system_wide, NULL);
free(key);
if (regexp) {
static const char *get_color_slot;
static char parsed_color[COLOR_MAXLEN];
-static int git_get_color_config(const char *var, const char *value)
+static int git_get_color_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, get_color_slot)) {
if (!value)
get_color_found = 0;
parsed_color[0] = '\0';
- git_config(git_get_color_config);
+ git_config(git_get_color_config, NULL);
if (!get_color_found && def_color)
color_parse(def_color, "command line", parsed_color);
static int stdout_is_tty;
static int get_colorbool_found;
static int get_diff_color_found;
-static int git_get_colorbool_config(const char *var, const char *value)
+static int git_get_colorbool_config(const char *var, const char *value,
+ void *cb)
{
if (!strcmp(var, get_color_slot)) {
get_colorbool_found =
get_colorbool_found = -1;
get_diff_color_found = -1;
get_color_slot = argv[0];
- git_config(git_get_colorbool_config);
+ git_config(git_get_colorbool_config, NULL);
if (get_colorbool_found < 0) {
if (!strcmp(get_color_slot, "color.diff"))
else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l")) {
if (argc != 2)
usage(git_config_set_usage);
- if (git_config(show_all_config) < 0 && file && errno)
+ if (git_config(show_all_config, NULL) < 0 &&
+ file && errno)
die("unable to read config file %s: %s", file,
strerror(errno));
return 0;
diff --git a/builtin-diff-files.c b/builtin-diff-files.c
index e2306c162a55df30042a0bf87c9a60a1e02f5396..907392a1f3d9b548389708c8c56c20a05bb5a69c 100644 (file)
--- a/builtin-diff-files.c
+++ b/builtin-diff-files.c
prefix = setup_git_directory_gently(&nongit);
init_revisions(&rev, prefix);
- git_config(git_diff_basic_config); /* no "diff" UI options */
+ git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
rev.abbrev = 0;
if (!setup_diff_no_index(&rev, argc, argv, nongit, prefix))
diff --git a/builtin-diff-index.c b/builtin-diff-index.c
index 2b955deb912a38ccabb115f8d3a6c7feb815eb45..2f44ebfcdd86cde2347258dbeb1e5c4b9cab0622 100644 (file)
--- a/builtin-diff-index.c
+++ b/builtin-diff-index.c
int result;
init_revisions(&rev, prefix);
- git_config(git_diff_basic_config); /* no "diff" UI options */
+ git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
rev.abbrev = 0;
argc = setup_revisions(argc, argv, &rev, NULL);
diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c
index 832797ff3bb45751758f0d629abb2cf8fa4507ad..9d2a48fd6833038fee1b608175f71a867bb9f3e6 100644 (file)
--- a/builtin-diff-tree.c
+++ b/builtin-diff-tree.c
int read_stdin = 0;
init_revisions(opt, prefix);
- git_config(git_diff_basic_config); /* no "diff" UI options */
+ git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
nr_sha1 = 0;
opt->abbrev = 0;
opt->diff = 1;
diff --git a/builtin-diff.c b/builtin-diff.c
index 7c2a8412fa8cefa2f53a5f7c2035ea9f2536e1c4..583291a9c0e52ed8c8e678606be7ec02b603db60 100644 (file)
--- a/builtin-diff.c
+++ b/builtin-diff.c
*/
prefix = setup_git_directory_gently(&nongit);
- git_config(git_diff_ui_config);
+ git_config(git_diff_ui_config, NULL);
if (diff_use_color_default == -1)
diff_use_color_default = git_use_color_default;
diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index e1c56303e5cb7882bc79980c4f8e6c6791ad323b..ff759cc578ac28c8f321124b25ff7539882382b6 100755 (executable)
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
};
/* we handle encodings */
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
init_revisions(&revs, prefix);
argc = setup_revisions(argc, argv, &revs, NULL);
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index c97a42739d23ac7ed90ae207e5a3770c388e66a7..de1e8d1365769c7c841749901f705c0b6a78eab3 100644 (file)
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
return dst;
}
-static int fetch_pack_config(const char *var, const char *value)
+static int fetch_pack_config(const char *var, const char *value, void *cb)
{
if (strcmp(var, "fetch.unpacklimit") == 0) {
fetch_unpack_limit = git_config_int(var, value);
return 0;
}
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
static struct lock_file lock;
static int did_setup;
if (did_setup)
return;
- git_config(fetch_pack_config);
+ git_config(fetch_pack_config, NULL);
if (0 <= transfer_unpack_limit)
unpack_limit = transfer_unpack_limit;
else if (0 <= fetch_unpack_limit)
index b72cb59e6a6aab33e7170826242d82785e4fa1e4..b892621ab50346ff29a0a1335de76e3f2fbbc723 100644 (file)
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
static int merge_summary;
-static int fmt_merge_msg_config(const char *key, const char *value)
+static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
{
static int found_merge_log = 0;
if (!strcmp("merge.log", key)) {
unsigned char head_sha1[20];
const char *current_branch;
- git_config(fmt_merge_msg_config);
+ git_config(fmt_merge_msg_config, NULL);
while (argc > 1) {
if (!strcmp(argv[1], "--log") || !strcmp(argv[1], "--summary"))
diff --git a/builtin-gc.c b/builtin-gc.c
index f99ebc7926b95b04f1140d257da7a52bfc33ee50..e1a329917a3844583e997480dd7408ce0aba00f9 100644 (file)
--- a/builtin-gc.c
+++ b/builtin-gc.c
static const char *argv_prune[] = {"prune", "--expire", NULL, NULL};
static const char *argv_rerere[] = {"rerere", "gc", NULL};
-static int gc_config(const char *var, const char *value)
+static int gc_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "gc.packrefs")) {
if (value && !strcmp(value, "notbare"))
prune_expire = xstrdup(value);
return 0;
}
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
static void append_option(const char **cmd, const char *opt, int max_length)
OPT_END()
};
- git_config(gc_config);
+ git_config(gc_config, NULL);
if (pack_refs < 0)
pack_refs = !is_bare_repository();
diff --git a/builtin-http-fetch.c b/builtin-http-fetch.c
index b1f33891c36fe38d855ace535cf9218fe9603541..3a062487a7eacd01ed824b46a9124dd343cd2e60 100644 (file)
--- a/builtin-http-fetch.c
+++ b/builtin-http-fetch.c
int get_verbosely = 0;
int get_recover = 0;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
while (arg < argc && argv[arg][0] == '-') {
if (argv[arg][1] == 't') {
diff --git a/builtin-init-db.c b/builtin-init-db.c
index a76f5d3474f9d1e16bfc988ad6fd1d971876fe91..f6aa3535299fdc56ff734c7476fcdfc7475a156d 100644 (file)
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -142,7 +142,7 @@ static void copy_templates(const char *git_dir, int len, const char *template_di
strcpy(template_path + template_len, "config");
repository_format_version = 0;
git_config_from_file(check_repository_format_version,
- template_path);
+ template_path, NULL);
template_path[template_len] = 0;
if (repository_format_version &&
path[len] = 0;
copy_templates(path, len, template_path);
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
/*
* We would have created the above under user's umask -- under
diff --git a/builtin-log.c b/builtin-log.c
index 80a01f8d44a40608e989b1cc1973a28c0b9040a5..addc7098cfd0c3ab0d0660fb6b14220f2ebf448f 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
return 0;
}
-static int git_log_config(const char *var, const char *value)
+static int git_log_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "format.pretty"))
return git_config_string(&fmt_pretty, var, value);
default_show_root = git_config_bool(var, value);
return 0;
}
- return git_diff_ui_config(var, value);
+ return git_diff_ui_config(var, value, cb);
}
int cmd_whatchanged(int argc, const char **argv, const char *prefix)
{
struct rev_info rev;
- git_config(git_log_config);
+ git_config(git_log_config, NULL);
if (diff_use_color_default == -1)
diff_use_color_default = git_use_color_default;
struct object_array_entry *objects;
int i, count, ret = 0;
- git_config(git_log_config);
+ git_config(git_log_config, NULL);
if (diff_use_color_default == -1)
diff_use_color_default = git_use_color_default;
{
struct rev_info rev;
- git_config(git_log_config);
+ git_config(git_log_config, NULL);
if (diff_use_color_default == -1)
diff_use_color_default = git_use_color_default;
{
struct rev_info rev;
- git_config(git_log_config);
+ git_config(git_log_config, NULL);
if (diff_use_color_default == -1)
diff_use_color_default = git_use_color_default;
extra_hdr[extra_hdr_nr++] = xstrndup(value, len);
}
-static int git_format_config(const char *var, const char *value)
+static int git_format_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "format.headers")) {
if (!value)
return 0;
}
- return git_log_config(var, value);
+ return git_log_config(var, value, cb);
}
char *add_signoff = NULL;
struct strbuf buf;
- git_config(git_format_config);
+ git_config(git_format_config, NULL);
init_revisions(&rev, prefix);
rev.commit_format = CMIT_FMT_EMAIL;
rev.verbose_header = 1;
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index dc7eab89b34fed32dbb198a9aa9a7503fc162216..75ba42246ee340634d317ec39948ed983171a42f 100644 (file)
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
memset(&dir, 0, sizeof(dir));
if (prefix)
prefix_offset = strlen(prefix);
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
diff --git a/builtin-ls-tree.c b/builtin-ls-tree.c
index 7abe333ce99a3448373119c1a811341cb15f1d10..f4a75ddbc3fecb9c1690a94d39ce230e82fefd8d 100644 (file)
--- a/builtin-ls-tree.c
+++ b/builtin-ls-tree.c
unsigned char sha1[20];
struct tree *tree;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
ls_tree_prefix = prefix;
if (prefix && *prefix)
chomp_prefix = strlen(prefix);
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index 11f154b31fcbd5c788299855e7d69f54ae8c7e70..6e23ffd8af386257da8547627bb46b4f1b319e34 100644 (file)
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
/* NEEDSWORK: might want to do the optional .git/ directory
* discovery
*/
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
def_charset = (git_commit_encoding ? git_commit_encoding : "utf-8");
metainfo_charset = def_charset;
diff --git a/builtin-merge-base.c b/builtin-merge-base.c
index 0108e22adee8b4de922a2b00b514dd4d4cf23c55..bcf9395aafb475edd22459eaf05cf5e180ca9b8f 100644 (file)
--- a/builtin-merge-base.c
+++ b/builtin-merge-base.c
unsigned char rev1key[20], rev2key[20];
int show_all = 0;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
while (1 < argc && argv[1][0] == '-') {
const char *arg = argv[1];
index 910c0d20e7ba1128c705a49bfd9966212c5420b2..e16f5e2a4e6a0acb3ea11414a92aed32716393c1 100644 (file)
return (struct commit *)object;
}
-static int merge_config(const char *var, const char *value)
+static int merge_config(const char *var, const char *value, void *cb)
{
if (!strcasecmp(var, "merge.verbosity")) {
verbosity = git_config_int(var, value);
rename_limit = git_config_int(var, value);
return 0;
}
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
subtree_merge = 1;
}
- git_config(merge_config);
+ git_config(merge_config, NULL);
if (getenv("GIT_MERGE_VERBOSITY"))
verbosity = strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10);
diff --git a/builtin-mv.c b/builtin-mv.c
index 94f6dd2aad2da512bab0be2e84859eced6553cc9..3edebef45f9220a7a76ad987debea73612350927 100644 (file)
--- a/builtin-mv.c
+++ b/builtin-mv.c
struct path_list deleted = {NULL, 0, 0, 0};
struct path_list changed = {NULL, 0, 0, 0};
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
newfd = hold_locked_index(&lock_file, 1);
if (read_cache() < 0)
diff --git a/builtin-name-rev.c b/builtin-name-rev.c
index 384da4db13d9ff82b9bd45e6ab26b5dbf925dc22..cde5de56fa43c1552722965343867b2baaebdaf4 100644 (file)
--- a/builtin-name-rev.c
+++ b/builtin-name-rev.c
OPT_END(),
};
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
argc = parse_options(argc, argv, opts, name_rev_usage, 0);
if (!!all + !!transform_stdin + !!argc > 1) {
error("Specify either a list, or --all, not both!");
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 777f272668c39931b330be555f41399adfbce397..a8dc225a722c16d68b6d6e18b633a2aa60ff07dd 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
free(delta_list);
}
-static int git_pack_config(const char *k, const char *v)
+static int git_pack_config(const char *k, const char *v, void *cb)
{
if(!strcmp(k, "pack.window")) {
window = git_config_int(k, v);
pack_size_limit_cfg = git_config_ulong(k, v);
return 0;
}
- return git_default_config(k, v);
+ return git_default_config(k, v, cb);
}
static void read_object_list_from_stdin(void)
rp_av[1] = "--objects"; /* --thin will make it --objects-edge */
rp_ac = 2;
- git_config(git_pack_config);
+ git_config(git_pack_config, NULL);
if (!pack_compression_seen && core_compression_seen)
pack_compression_level = core_compression_level;
diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 7ac30883bc72c51b0227828bef5758751e524f65..5a09e17f1ad4fe19cf4e7cc29235d14d35405168 100644 (file)
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
opts.src_index = &the_index;
opts.dst_index = &the_index;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
newfd = hold_locked_index(&lock_file, 1);
- git_config(git_default_config);
-
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
diff --git a/builtin-reflog.c b/builtin-reflog.c
index 280e24e1514f2989b571acc768d7067cbb223933..897d1dcac6b34e0c631c94b98c489db075e90bb2 100644 (file)
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -329,7 +329,7 @@ static int collect_reflog(const char *ref, const unsigned char *sha1, int unused
return 0;
}
-static int reflog_expire_config(const char *var, const char *value)
+static int reflog_expire_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "gc.reflogexpire")) {
if (!value)
default_reflog_expire_unreachable = approxidate(value);
return 0;
}
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
unsigned long now = time(NULL);
int i, status, do_all;
- git_config(reflog_expire_config);
+ git_config(reflog_expire_config, NULL);
save_commit_buffer = 0;
do_all = status = 0;
diff --git a/builtin-remote.c b/builtin-remote.c
index 8b63619ef08a2ac3d96000908fe4986396ddd6a2..99a34dfe86a79df353d3c094cb2ebf71fdca1cc0 100644 (file)
--- a/builtin-remote.c
+++ b/builtin-remote.c
static struct path_list branch_list;
-static int config_read_branches(const char *key, const char *value)
+static int config_read_branches(const char *key, const char *value, void *cb)
{
if (!prefixcmp(key, "branch.")) {
char *name;
{
if (branch_list.nr)
return;
- git_config(config_read_branches);
+ git_config(config_read_branches, NULL);
sort_path_list(&branch_list);
}
struct path_list *list;
} remote_group;
-static int get_remote_group(const char *key, const char *value)
+static int get_remote_group(const char *key, const char *value, void *cb)
{
if (!prefixcmp(key, "remotes.") &&
!strcmp(key + 8, remote_group.name)) {
remote_group.list = &list;
for (i = 1; i < argc; i++) {
remote_group.name = argv[i];
- result = git_config(get_remote_group);
+ result = git_config(get_remote_group, NULL);
}
if (!result && !list.nr && argc == 2 && !strcmp(argv[1], "default"))
diff --git a/builtin-rerere.c b/builtin-rerere.c
index c607aade637423f0129167163fa4055b08546248..5c811423cc1234d933cff013f9923b45f19dc6fa 100644 (file)
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
return write_rr(rr, fd);
}
-static int git_rerere_config(const char *var, const char *value)
+static int git_rerere_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "gc.rerereresolved"))
cutoff_resolve = git_config_int(var, value);
else if (!strcmp(var, "rerere.enabled"))
rerere_enabled = git_config_bool(var, value);
else
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
return 0;
}
{
int fd;
- git_config(git_rerere_config);
+ git_config(git_rerere_config, NULL);
if (!is_rerere_enabled())
return -1;
diff --git a/builtin-reset.c b/builtin-reset.c
index 79424bb26efb4525b6bc2080e639b51d59eaabd9..e32ddd90ac9e6f1bdf755b268d1a7c8b034c9e63 100644 (file)
--- a/builtin-reset.c
+++ b/builtin-reset.c
OPT_END()
};
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
argc = parse_options(argc, argv, options, git_reset_usage,
PARSE_OPT_KEEP_DASHDASH);
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index edc0bd35bb0e96a230284250dc4c40776cf7caac..274299044ea9c55221298303e212580810ed2006 100644 (file)
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
int bisect_find_all = 0;
int quiet = 0;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
init_revisions(&revs, prefix);
revs.abbrev = 0;
revs.commit_format = CMIT_FMT_UNSPECIFIED;
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index f8d8548e9cddd7d2d123fcf0fdee513754df86c1..1d019b3c16a3ac5eae4c14921534f653fa9c71c1 100644 (file)
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
return cmd_parseopt(argc - 1, argv + 1, prefix);
prefix = setup_git_directory();
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
diff --git a/builtin-revert.c b/builtin-revert.c
index 2b57525d7234086bdf2022d13fa405e5007627fb..0270f9b85a8229d30ab3fab5ce73661f383b005e 100644 (file)
--- a/builtin-revert.c
+++ b/builtin-revert.c
const char *message, *encoding;
const char *defmsg = xstrdup(git_path("MERGE_MSG"));
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
me = action == REVERT ? "revert" : "cherry-pick";
setenv(GIT_REFLOG_ACTION, me, 0);
parse_args(argc, argv);
diff --git a/builtin-rm.c b/builtin-rm.c
index c0a8bb6cf5675d671a2cca50bf72d5c60f155313..22c9bd1c6cf2d372e0262506cc1e21daebdf579a 100644 (file)
--- a/builtin-rm.c
+++ b/builtin-rm.c
const char **pathspec;
char *seen;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
newfd = hold_locked_index(&lock_file, 1);
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 019abd3527e7c573c69900a58313749e2ef2280a..ee4269dd33aa0b2229eaac0ce7b75f7893447b0f 100644 (file)
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
die("bad sha1 reference %s", av);
}
-static int git_show_branch_config(const char *var, const char *value)
+static int git_show_branch_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "showbranch.default")) {
if (!value)
return 0;
}
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
static int omit_in_dense(struct commit *commit, struct commit **rev, int n)
int reflog = 0;
const char *reflog_base = NULL;
- git_config(git_show_branch_config);
+ git_config(git_show_branch_config, NULL);
/* If nothing is specified, try the default first */
if (ac == 1 && default_num) {
diff --git a/builtin-symbolic-ref.c b/builtin-symbolic-ref.c
index d33982b967e7665ae79fb186435d9ed9aabb907b..b49bdb6900f2c49b55880f9f220597bf3f156810 100644 (file)
--- a/builtin-symbolic-ref.c
+++ b/builtin-symbolic-ref.c
OPT_END(),
};
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
argc = parse_options(argc, argv, options, git_symbolic_ref_usage, 0);
if (msg &&!*msg)
die("Refusing to perform update with empty message");
diff --git a/builtin-tag.c b/builtin-tag.c
index 129ff57f11d2cdfdacc6be9685736ada07caef7f..e675206de38f0709b4c07e1667d791bf9b6704cb 100644 (file)
--- a/builtin-tag.c
+++ b/builtin-tag.c
die("signing key value too long (%.10s...)", value);
}
-static int git_tag_config(const char *var, const char *value)
+static int git_tag_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "user.signingkey")) {
if (!value)
return 0;
}
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
static void write_tag_body(int fd, const unsigned char *sha1)
OPT_END()
};
- git_config(git_tag_config);
+ git_config(git_tag_config, NULL);
argc = parse_options(argc, argv, options, git_tag_usage, 0);
index fecf0be7796f34fbb06a6bbbe61e9e3d042f6780..85043d1fde917e67746fb1ee106ce2cf78f3d161 100644 (file)
--- a/builtin-unpack-objects.c
+++ b/builtin-unpack-objects.c
int i;
unsigned char sha1[20];
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
quiet = !isatty(2);
diff --git a/builtin-update-index.c b/builtin-update-index.c
index a8795d3d5fea9f340dfe21a71190f120c63856cd..e1ca8deac2158f06208e69e2dc31fff48fac4f88 100644 (file)
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
int lock_error = 0;
struct lock_file *lock_file;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
/* We can't free this memory, it becomes part of a linked list parsed atexit() */
lock_file = xcalloc(1, sizeof(struct lock_file));
diff --git a/builtin-update-ref.c b/builtin-update-ref.c
index e90737c350402fec8937a9e343485e1c71411f55..93c127196d272d99d8af24a5fbc7ac89efdbb3d4 100644 (file)
--- a/builtin-update-ref.c
+++ b/builtin-update-ref.c
OPT_END(),
};
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
argc = parse_options(argc, argv, options, git_update_ref_usage, 0);
if (msg && !*msg)
die("Refusing to perform update with empty message.");
diff --git a/builtin-verify-pack.c b/builtin-verify-pack.c
index 4958bbbf11f5f796feedfa7480b827029f912d01..4c515a0570ec2b05e5dca8156d885a70b922251e 100644 (file)
--- a/builtin-verify-pack.c
+++ b/builtin-verify-pack.c
int no_more_options = 0;
int nothing_done = 1;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
while (1 < argc) {
if (!no_more_options && argv[1][0] == '-') {
if (!strcmp("-v", argv[1]))
diff --git a/builtin-verify-tag.c b/builtin-verify-tag.c
index db81496b464e253341a42e01eb72d6845e87199c..92eaa89a45eff2e76e531a914bdccca5fafe98b0 100644 (file)
--- a/builtin-verify-tag.c
+++ b/builtin-verify-tag.c
{
int i = 1, verbose = 0, had_error = 0;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
if (argc == 1)
usage(builtin_verify_tag_usage);
diff --git a/builtin-write-tree.c b/builtin-write-tree.c
index e838d01233eb1d6cfaa0885c6b37c8726079b0ac..c2187997447df64948577d8a9a78f4462239b369 100644 (file)
--- a/builtin-write-tree.c
+++ b/builtin-write-tree.c
unsigned char sha1[20];
const char *me = "git-write-tree";
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
while (1 < argc) {
const char *arg = argv[1];
if (!strcmp(arg, "--missing-ok"))
index 9cee9a5f3fb2e51f617dcf9f92defcd596b97c10..ebe4031b65dc0e2ff9f9c05e9a423d70c9b17ba1 100644 (file)
--- a/cache.h
+++ b/cache.h
/* Dumb servers support */
extern int update_server_info(int);
-typedef int (*config_fn_t)(const char *, const char *);
-extern int git_default_config(const char *, const char *);
-extern int git_config_from_file(config_fn_t fn, const char *);
-extern int git_config(config_fn_t fn);
+typedef int (*config_fn_t)(const char *, const char *, void *);
+extern int git_default_config(const char *, const char *, void *);
+extern int git_config_from_file(config_fn_t fn, const char *, void *);
+extern int git_config(config_fn_t fn, void *);
extern int git_parse_long(const char *, long *);
extern int git_parse_ulong(const char *, unsigned long *);
extern int git_config_int(const char *, const char *);
extern int git_config_set_multivar(const char *, const char *, const char *, int);
extern int git_config_rename_section(const char *, const char *);
extern const char *git_etc_gitconfig(void);
-extern int check_repository_format_version(const char *var, const char *value);
+extern int check_repository_format_version(const char *var, const char *value, void *cb);
extern int git_env_bool(const char *, int);
extern int git_config_system(void);
extern int git_config_global(void);
index 12a6453f90eb4ce2b39f85762bf3acd1cff2b9f2..fc0b72ad59b13e4bd86372e5e81b4f400c99d26e 100644 (file)
--- a/color.c
+++ b/color.c
@@ -145,14 +145,14 @@ int git_config_colorbool(const char *var, const char *value, int stdout_is_tty)
return 0;
}
-int git_color_default_config(const char *var, const char *value)
+int git_color_default_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "color.ui")) {
git_use_color_default = git_config_colorbool(var, value, -1);
return 0;
}
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
static int color_vfprintf(FILE *fp, const char *color, const char *fmt,
index ecda5569a2cccabaf16fcf0aad3bce57dfb3aca4..6cf5c88aaf8d0e38e2853e6fd212e3cdd6c180cb 100644 (file)
--- a/color.h
+++ b/color.h
/*
* Use this instead of git_default_config if you need the value of color.ui.
*/
-int git_color_default_config(const char *var, const char *value);
+int git_color_default_config(const char *var, const char *value, void *cb);
int git_config_colorbool(const char *var, const char *value, int stdout_is_tty);
void color_parse(const char *var, const char *value, char *dst);
diff --git a/config.c b/config.c
index 0e22c7a6423c211b2e2a95b0535b85dc9f234a1f..5431e2dc01b01b60de6e1392e242c9b0e5d2a8cf 100644 (file)
--- a/config.c
+++ b/config.c
return isalnum(c) || c == '-';
}
-static int get_value(config_fn_t fn, char *name, unsigned int len)
+static int get_value(config_fn_t fn, void *data, char *name, unsigned int len)
{
int c;
char *value;
if (!value)
return -1;
}
- return fn(name, value);
+ return fn(name, value, data);
}
static int get_extended_base_var(char *name, int baselen, int c)
}
}
-static int git_parse_file(config_fn_t fn)
+static int git_parse_file(config_fn_t fn, void *data)
{
int comment = 0;
int baselen = 0;
if (!isalpha(c))
break;
var[baselen] = tolower(c);
- if (get_value(fn, var, baselen+1) < 0)
+ if (get_value(fn, data, var, baselen+1) < 0)
break;
}
die("bad config file line %d in %s", config_linenr, config_file_name);
return 0;
}
-int git_default_config(const char *var, const char *value)
+int git_default_config(const char *var, const char *value, void *dummy)
{
/* This needs a better name */
if (!strcmp(var, "core.filemode")) {
return 0;
}
-int git_config_from_file(config_fn_t fn, const char *filename)
+int git_config_from_file(config_fn_t fn, const char *filename, void *data)
{
int ret;
FILE *f = fopen(filename, "r");
config_file_name = filename;
config_linenr = 1;
config_file_eof = 0;
- ret = git_parse_file(fn);
+ ret = git_parse_file(fn, data);
fclose(f);
config_file_name = NULL;
}
return !git_env_bool("GIT_CONFIG_NOGLOBAL", 0);
}
-int git_config(config_fn_t fn)
+int git_config(config_fn_t fn, void *data)
{
int ret = 0;
char *repo_config = NULL;
filename = getenv(CONFIG_ENVIRONMENT);
if (!filename) {
if (git_config_system() && !access(git_etc_gitconfig(), R_OK))
- ret += git_config_from_file(fn, git_etc_gitconfig());
+ ret += git_config_from_file(fn, git_etc_gitconfig(),
+ data);
home = getenv("HOME");
filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
if (!filename)
if (git_config_global() && home) {
char *user_config = xstrdup(mkpath("%s/.gitconfig", home));
if (!access(user_config, R_OK))
- ret = git_config_from_file(fn, user_config);
+ ret = git_config_from_file(fn, user_config, data);
free(user_config);
}
- ret += git_config_from_file(fn, filename);
+ ret += git_config_from_file(fn, filename, data);
free(repo_config);
return ret;
}
!regexec(store.value_regex, value, 0, NULL, 0)));
}
-static int store_aux(const char* key, const char* value)
+static int store_aux(const char* key, const char* value, void *cb)
{
const char *ep;
size_t section_len;
* As a side effect, we make sure to transform only a valid
* existing config file.
*/
- if (git_config_from_file(store_aux, config_filename)) {
+ if (git_config_from_file(store_aux, config_filename, NULL)) {
error("invalid config file %s", config_filename);
free(store.key);
if (store.value_regex != NULL) {
diff --git a/connect.c b/connect.c
index d12b105970bca82017998cae52f5807629736bb9..e92af2973565197f2f001c45c6059f9a838fe289 100644 (file)
--- a/connect.c
+++ b/connect.c
static const char *rhost_name;
static int rhost_len;
-static int git_proxy_command_options(const char *var, const char *value)
+static int git_proxy_command_options(const char *var, const char *value,
+ void *cb)
{
if (!strcmp(var, "core.gitproxy")) {
const char *for_pos;
return 0;
}
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
static int git_use_proxy(const char *host)
rhost_name = host;
rhost_len = strlen(host);
git_proxy_command = getenv("GIT_PROXY_COMMAND");
- git_config(git_proxy_command_options);
+ git_config(git_proxy_command_options, NULL);
rhost_name = NULL;
return (git_proxy_command && *git_proxy_command);
}
diff --git a/convert.c b/convert.c
index d8c94cb3edeceff7a79b2f5e6ba7cad250e6b301..1c66844783ec3baa1373b3f0c41ea080bc7354fe 100644 (file)
--- a/convert.c
+++ b/convert.c
char *clean;
} *user_convert, **user_convert_tail;
-static int read_convert_config(const char *var, const char *value)
+static int read_convert_config(const char *var, const char *value, void *cb)
{
const char *ep, *name;
int namelen;
attr_ident = git_attr("ident", 5);
attr_filter = git_attr("filter", 6);
user_convert_tail = &user_convert;
- git_config(read_convert_config);
+ git_config(read_convert_config, NULL);
}
check[0].attr = attr_crlf;
check[1].attr = attr_ident;
diff --git a/daemon.c b/daemon.c
index 2b4a6f145cc0f37c95da31df23dfde3ba7fa63a7..63cd12cd9c1909edbaab49aea066ff6fe03c3542 100644 (file)
--- a/daemon.c
+++ b/daemon.c
static struct daemon_service *service_looking_at;
static int service_enabled;
-static int git_daemon_config(const char *var, const char *value)
+static int git_daemon_config(const char *var, const char *value, void *cb)
{
if (!prefixcmp(var, "daemon.") &&
!strcmp(var + 7, service_looking_at->config_name)) {
if (service->overridable) {
service_looking_at = service;
service_enabled = -1;
- git_config(git_daemon_config);
+ git_config(git_daemon_config, NULL);
if (0 <= service_enabled)
enabled = service_enabled;
}
index e35384b4442fbaedbf460ddf61c32b85dde2a4d7..1f46ff0f083fd307601b1e3e34e6626ec6801704 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -129,7 +129,7 @@ static int parse_funcname_pattern(const char *var, const char *ep, const char *v
* never be affected by the setting of diff.renames
* the user happens to have in the configuration file.
*/
-int git_diff_ui_config(const char *var, const char *value)
+int git_diff_ui_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "diff.renamelimit")) {
diff_rename_limit_default = git_config_int(var, value);
return parse_lldiff_command(var, ep, value);
}
- return git_diff_basic_config(var, value);
+ return git_diff_basic_config(var, value, cb);
}
-int git_diff_basic_config(const char *var, const char *value)
+int git_diff_basic_config(const char *var, const char *value, void *cb)
{
if (!prefixcmp(var, "diff.color.") || !prefixcmp(var, "color.diff.")) {
int slot = parse_diff_color_slot(var, 11);
}
}
- return git_color_default_config(var, value);
+ return git_color_default_config(var, value, cb);
}
static char *quote_two(const char *one, const char *two)
index 1bd94a4807c741e7cb2e4d8eb9f6476eba691388..1cf1eff485e58b3714e495888a3b26cf3b005049 100644 (file)
--- a/diff.h
+++ b/diff.h
#define DIFF_SETUP_USE_CACHE 2
#define DIFF_SETUP_USE_SIZE_CACHE 4
-extern int git_diff_basic_config(const char *var, const char *value);
-extern int git_diff_ui_config(const char *var, const char *value);
+extern int git_diff_basic_config(const char *var, const char *value, void *cb);
+extern int git_diff_ui_config(const char *var, const char *value, void *cb);
extern int diff_use_color_default;
extern void diff_setup(struct diff_options *);
extern int diff_opt_parse(struct diff_options *, const char **, int);
diff --git a/fast-import.c b/fast-import.c
index 73e5439d97481a0e4dcaa17d025b27ec3fdcf41b..36ec5b87f8878dacedc9fc3f4acc5b51644a4b71 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
fclose(f);
}
-static int git_pack_config(const char *k, const char *v)
+static int git_pack_config(const char *k, const char *v, void *cb)
{
if (!strcmp(k, "pack.depth")) {
max_depth = git_config_int(k, v);
pack_compression_seen = 1;
return 0;
}
- return git_default_config(k, v);
+ return git_default_config(k, v, cb);
}
static const char fast_import_usage[] =
unsigned int i, show_stats = 1;
setup_git_directory();
- git_config(git_pack_config);
+ git_config(git_pack_config, NULL);
if (!pack_compression_seen && core_compression_seen)
pack_compression_level = core_compression_level;
diff --git a/hash-object.c b/hash-object.c
index 61e7160b361f60e6d673ab64aa3d22c1a783d057..3d773900ff270114c21aa71f613f9fd69f79416a 100644 (file)
--- a/hash-object.c
+++ b/hash-object.c
int no_more_flags = 0;
int hashstdin = 0;
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
for (i = 1 ; i < argc; i++) {
if (!no_more_flags && argv[i][0] == '-') {
index af80979fcb177faace150a7cfa7cb66daeb59f49..d89d43796f3ee9d3689131d48861967048f5c5d7 100644 (file)
--- a/help.c
+++ b/help.c
return 0;
}
-static int git_help_config(const char *var, const char *value)
+static int git_help_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "help.format")) {
if (!value)
if (!prefixcmp(var, "man."))
return add_man_viewer_info(var, value);
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
/* most GUI terminals set COLUMNS (although some don't export it) */
const char *alias;
setup_git_directory_gently(&nongit);
- git_config(git_help_config);
+ git_config(git_help_config, NULL);
argc = parse_options(argc, argv, builtin_help_options,
builtin_help_usage, 0);
index acf746a12da0f0b5e3fe3f097a6626e17da8852c..2a21ccbb76351d108301d2b9c334e2c5a5feacd9 100644 (file)
--- a/http.c
+++ b/http.c
}
#endif
-static int http_options(const char *var, const char *value)
+static int http_options(const char *var, const char *value, void *cb)
{
if (!strcmp("http.sslverify", var)) {
if (curl_ssl_verify == -1) {
}
/* Fall back on the default ones */
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
static CURL* get_curl_handle(void)
if (low_speed_time != NULL)
curl_low_speed_time = strtol(low_speed_time, NULL, 10);
- git_config(http_options);
+ git_config(http_options, NULL);
if (curl_ssl_verify == -1)
curl_ssl_verify = 1;
diff --git a/imap-send.c b/imap-send.c
index db6559725e6867131800b6682348ebbf896ddbf5..1ec131092109aa3fbed3cd20f10b56a864584a94 100644 (file)
--- a/imap-send.c
+++ b/imap-send.c
static char *imap_folder;
static int
-git_imap_config(const char *key, const char *val)
+git_imap_config(const char *key, const char *val, void *cb)
{
char imap_key[] = "imap.";
/* init the random number generator */
arc4_init();
- git_config( git_imap_config );
+ git_config(git_imap_config, NULL);
if (!imap_folder) {
fprintf( stderr, "no imap store specified\n" );
diff --git a/index-pack.c b/index-pack.c
index 9c0c27813fd6736218d1caaed6248e4ae4d388b5..aaba9443ccbab1315e67c0e6bedaa82afe5464fc 100644 (file)
--- a/index-pack.c
+++ b/index-pack.c
}
}
-static int git_index_pack_config(const char *k, const char *v)
+static int git_index_pack_config(const char *k, const char *v, void *cb)
{
if (!strcmp(k, "pack.indexversion")) {
pack_idx_default_version = git_config_int(k, v);
die("bad pack.indexversion=%d", pack_idx_default_version);
return 0;
}
- return git_default_config(k, v);
+ return git_default_config(k, v, cb);
}
int main(int argc, char **argv)
struct pack_idx_entry **idx_objects;
unsigned char sha1[20];
- git_config(git_index_pack_config);
+ git_config(git_index_pack_config, NULL);
for (i = 1; i < argc; i++) {
char *arg = argv[i];
diff --git a/ll-merge.c b/ll-merge.c
index 5ae74331bc2c55638bc5bf1bbfdc7e340199cb01..9837c842a3f215ebee7cbe9690e42e216fb5c76c 100644 (file)
--- a/ll-merge.c
+++ b/ll-merge.c
static struct ll_merge_driver *ll_user_merge, **ll_user_merge_tail;
static const char *default_ll_merge;
-static int read_merge_config(const char *var, const char *value)
+static int read_merge_config(const char *var, const char *value, void *cb)
{
struct ll_merge_driver *fn;
const char *ep, *name;
if (ll_user_merge_tail)
return;
ll_user_merge_tail = &ll_user_merge;
- git_config(read_merge_config);
+ git_config(read_merge_config, NULL);
}
static const struct ll_merge_driver *find_ll_merge_driver(const char *merge_attr)
index ca002f9f791b6cdb8257836be9e13fe648afa1cc..dbd941421bf90bb1c4b6ad26ba46869f57d15cd8 100644 (file)
--- a/pager.c
+++ b/pager.c
return;
if (!pager) {
if (!pager_program)
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
pager = pager_program;
}
if (!pager)
diff --git a/receive-pack.c b/receive-pack.c
index 828d49001d6c8494ede35e4ebbcea4fe482802dd..b26f2e3a41c870d1b73690e389dbd74a8b8a40a0 100644 (file)
--- a/receive-pack.c
+++ b/receive-pack.c
static char capabilities[] = " report-status delete-refs ";
static int capabilities_sent;
-static int receive_pack_config(const char *var, const char *value)
+static int receive_pack_config(const char *var, const char *value, void *cb)
{
if (strcmp(var, "receive.denynonfastforwards") == 0) {
deny_non_fast_forwards = git_config_bool(var, value);
return 0;
}
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
static int show_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
if (is_repository_shallow())
die("attempt to push into a shallow repository");
- git_config(receive_pack_config);
+ git_config(receive_pack_config, NULL);
if (0 <= transfer_unpack_limit)
unpack_limit = transfer_unpack_limit;
diff --git a/remote.c b/remote.c
index 91cbb72ddeba1c60dab7aad2105e1c004ea6e198..dff6c5f686d51a5352989ac2c395f387c1903491 100644 (file)
--- a/remote.c
+++ b/remote.c
remote->fetch_tags = 1; /* always auto-follow */
}
-static int handle_config(const char *key, const char *value)
+static int handle_config(const char *key, const char *value, void *cb)
{
const char *name;
const char *subkey;
current_branch =
make_branch(head_ref + strlen("refs/heads/"), 0);
}
- git_config(handle_config);
+ git_config(handle_config, NULL);
alias_all_urls();
}
index b8fd476395db782bf942a548b87242b3a9f990f4..d630e374e7c03b934de14adceb93c9c327796e6d 100644 (file)
--- a/setup.c
+++ b/setup.c
static int check_repository_format_gently(int *nongit_ok)
{
- git_config(check_repository_format_version);
+ git_config(check_repository_format_version, NULL);
if (GIT_REPO_VERSION < repository_format_version) {
if (!nongit_ok)
die ("Expected git repo version <= %d, found %d",
return i & 0666;
}
-int check_repository_format_version(const char *var, const char *value)
+int check_repository_format_version(const char *var, const char *value, void *cb)
{
if (strcmp(var, "core.repositoryformatversion") == 0)
repository_format_version = git_config_int(var, value);
diff --git a/unpack-file.c b/unpack-file.c
index 65c66eb0bf34efee6485db3dbf8af11788c394f4..bcdc8bbb3b44a43aa43db6035a31478158e070af 100644 (file)
--- a/unpack-file.c
+++ b/unpack-file.c
die("Not a valid object name %s", argv[1]);
setup_git_directory();
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
puts(create_temp_file(sha1));
return 0;
index c20ac919bdbe73c8cd7657d468d2dfbccf6d3aa2..724ba87a7c9ccb16bc506fc3f25710a4b78e3006 100644 (file)
--- a/var.c
+++ b/var.c
return val;
}
-static int show_config(const char *var, const char *value)
+static int show_config(const char *var, const char *value, void *cb)
{
if (value)
printf("%s=%s\n", var, value);
else
printf("%s\n", var);
- return git_default_config(var, value);
+ return git_default_config(var, value, cb);
}
int main(int argc, char **argv)
val = NULL;
if (strcmp(argv[1], "-l") == 0) {
- git_config(show_config);
+ git_config(show_config, NULL);
list_vars();
return 0;
}
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
val = read_var(argv[1]);
if (!val)
usage(var_usage);
diff --git a/wt-status.c b/wt-status.c
index 532b4ea2c1960f18e41a5167a60f6de1b481606b..c932b39d20407ff08f0bf52963a75dc717e74920 100644 (file)
--- a/wt-status.c
+++ b/wt-status.c
}
}
-int git_status_config(const char *k, const char *v)
+int git_status_config(const char *k, const char *v, void *cb)
{
if (!strcmp(k, "status.submodulesummary")) {
int is_bool;
wt_status_relative_paths = git_config_bool(k, v);
return 0;
}
- return git_color_default_config(k, v);
+ return git_color_default_config(k, v, cb);
}
diff --git a/wt-status.h b/wt-status.h
index 7d61410b1733825e3bb8042781a75de3ee62c41d..f2c71302cb18e30e82059b787b4cff99080115b9 100644 (file)
--- a/wt-status.h
+++ b/wt-status.h
const char *prefix;
};
-int git_status_config(const char *var, const char *value);
+int git_status_config(const char *var, const char *value, void *cb);
extern int wt_status_use_color;
extern int wt_status_relative_paths;
void wt_status_prepare(struct wt_status *s);