Provide git_config with a callback-data parameter
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>
Johannes Schindelin committed
May 14, 2008 at 18:46 UTC
ef90d6d4208a5130185b04f06e5f90a5f9959fe3
74 files changed
+176
-173
alias.c
+3
-2
@@ -2,7 +2,8 @@
2
3
static const char *alias_key;
4
static char *alias_val;
5
-static int alias_lookup_cb(const char *k, const char *v)
5
+
6
+static int alias_lookup_cb(const char *k, const char *v, void *cb)
7
{
8
if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) {
9
if (!v)
@@ -17,6 +18,6 @@ char *alias_lookup(const char *alias)
18
{
19
alias_key = alias;
20
alias_val = NULL;
20
- git_config(alias_lookup_cb);
21
+ git_config(alias_lookup_cb, NULL);
22
return alias_val;
23
}
archive-tar.c
+3
-3
@@ -220,7 +220,7 @@ static void write_global_extended_header(const unsigned char *sha1)
220
strbuf_release(&ext_header);
221
}
222
223
-static int git_tar_config(const char *var, const char *value)
223
+static int git_tar_config(const char *var, const char *value, void *cb)
224
{
225
if (!strcmp(var, "tar.umask")) {
226
if (value && !strcmp(value, "user")) {
@@ -231,7 +231,7 @@ static int git_tar_config(const char *var, const char *value)
231
}
232
return 0;
233
}
234
- return git_default_config(var, value);
234
+ return git_default_config(var, value, cb);
235
}
236
237
static int write_tar_entry(const unsigned char *sha1,
@@ -268,7 +268,7 @@ int write_tar_archive(struct archiver_args *args)
268
{
269
int plen = args->base ? strlen(args->base) : 0;
270
271
- git_config(git_tar_config);
271
+ git_config(git_tar_config, NULL);
272
273
archive_time = args->time;
274
verbose = args->verbose;
builtin-add.c
+1
-1
@@ -203,7 +203,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
203
if (add_interactive)
204
exit(interactive_add(argc, argv, prefix));
205
206
- git_config(git_default_config);
206
+ git_config(git_default_config, NULL);
207
208
newfd = hold_locked_index(&lock_file, 1);
209
builtin-apply.c
+3
-3
@@ -2979,11 +2979,11 @@ static int apply_patch(int fd, const char *filename, int inaccurate_eof)
2979
return 0;
2980
}
2981
2982
-static int git_apply_config(const char *var, const char *value)
2982
+static int git_apply_config(const char *var, const char *value, void *cb)
2983
{
2984
if (!strcmp(var, "apply.whitespace"))
2985
return git_config_string(&apply_default_whitespace, var, value);
2986
- return git_default_config(var, value);
2986
+ return git_default_config(var, value, cb);
2987
}
2988
2989
@@ -2999,7 +2999,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
2999
3000
prefix = setup_git_directory_gently(&is_not_gitdir);
3001
prefix_length = prefix ? strlen(prefix) : 0;
3002
- git_config(git_apply_config);
3002
+ git_config(git_apply_config, NULL);
3003
if (apply_default_whitespace)
3004
parse_whitespace_option(apply_default_whitespace);
3005
builtin-blame.c
+3
-3
@@ -1993,7 +1993,7 @@ static void prepare_blame_range(struct scoreboard *sb,
1993
usage(blame_usage);
1994
}
1995
1996
-static int git_blame_config(const char *var, const char *value)
1996
+static int git_blame_config(const char *var, const char *value, void *cb)
1997
{
1998
if (!strcmp(var, "blame.showroot")) {
1999
show_root = git_config_bool(var, value);
@@ -2003,7 +2003,7 @@ static int git_blame_config(const char *var, const char *value)
2003
blank_boundary = git_config_bool(var, value);
2004
return 0;
2005
}
2006
- return git_default_config(var, value);
2006
+ return git_default_config(var, value, cb);
2007
}
2008
2009
static struct commit *fake_working_tree_commit(const char *path, const char *contents_from)
@@ -2141,7 +2141,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
2141
2142
cmd_is_annotate = !strcmp(argv[0], "annotate");
2143
2144
- git_config(git_blame_config);
2144
+ git_config(git_blame_config, NULL);
2145
save_commit_buffer = 0;
2146
2147
opt = 0;
builtin-branch.c
+3
-3
@@ -63,7 +63,7 @@ static int parse_branch_color_slot(const char *var, int ofs)
63
die("bad config variable '%s'", var);
64
}
65
66
-static int git_branch_config(const char *var, const char *value)
66
+static int git_branch_config(const char *var, const char *value, void *cb)
67
{
68
if (!strcmp(var, "color.branch")) {
69
branch_use_color = git_config_colorbool(var, value, -1);
@@ -76,7 +76,7 @@ static int git_branch_config(const char *var, const char *value)
76
color_parse(value, var, branch_colors[slot]);
77
return 0;
78
}
79
- return git_color_default_config(var, value);
79
+ return git_color_default_config(var, value, cb);
80
}
81
82
static const char *branch_get_color(enum color_branch ix)
@@ -461,7 +461,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
461
OPT_END(),
462
};
463
464
- git_config(git_branch_config);
464
+ git_config(git_branch_config, NULL);
465
466
if (branch_use_color == -1)
467
branch_use_color = git_use_color_default;
builtin-cat-file.c
+1
-1
@@ -85,7 +85,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
85
int opt;
86
const char *exp_type, *obj_name;
87
88
- git_config(git_default_config);
88
+ git_config(git_default_config, NULL);
89
if (argc != 3)
90
usage("git-cat-file [-t|-s|-e|-p|<type>] <sha1>");
91
exp_type = argv[1];
builtin-checkout-index.c
+1
-1
@@ -166,7 +166,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
166
int read_from_stdin = 0;
167
int prefix_length;
168
169
- git_config(git_default_config);
169
+ git_config(git_default_config, NULL);
170
state.base_dir = "";
171
prefix_length = prefix ? strlen(prefix) : 0;
172
builtin-checkout.c
+1
-1
@@ -514,7 +514,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
514
memset(&opts, 0, sizeof(opts));
515
memset(&new, 0, sizeof(new));
516
517
- git_config(git_default_config);
517
+ git_config(git_default_config, NULL);
518
519
opts.track = git_branch_track;
520
builtin-clean.c
+3
-3
@@ -19,11 +19,11 @@ static const char *const builtin_clean_usage[] = {
19
NULL
20
};
21
22
-static int git_clean_config(const char *var, const char *value)
22
+static int git_clean_config(const char *var, const char *value, void *cb)
23
{
24
if (!strcmp(var, "clean.requireforce"))
25
force = !git_config_bool(var, value);
26
- return git_default_config(var, value);
26
+ return git_default_config(var, value, cb);
27
}
28
29
int cmd_clean(int argc, const char **argv, const char *prefix)
@@ -50,7 +50,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
50
OPT_END()
51
};
52
53
- git_config(git_clean_config);
53
+ git_config(git_clean_config, NULL);
54
if (force < 0)
55
force = 0;
56
else
builtin-commit-tree.c
+1
-1
@@ -60,7 +60,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
60
struct strbuf buffer;
61
int encoding_is_utf8;
62
63
- git_config(git_default_config);
63
+ git_config(git_default_config, NULL);
64
65
if (argc < 2)
66
usage(commit_tree_usage);
builtin-commit.c
+4
-4
@@ -773,7 +773,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
773
const char *index_file;
774
int commitable;
775
776
- git_config(git_status_config);
776
+ git_config(git_status_config, NULL);
777
778
if (wt_status_use_color == -1)
779
wt_status_use_color = git_use_color_default;
@@ -827,7 +827,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
827
}
828
}
829
830
-int git_commit_config(const char *k, const char *v)
830
+int git_commit_config(const char *k, const char *v, void *cb)
831
{
832
if (!strcmp(k, "commit.template")) {
833
if (!v)
@@ -836,7 +836,7 @@ int git_commit_config(const char *k, const char *v)
836
return 0;
837
}
838
839
- return git_status_config(k, v);
839
+ return git_status_config(k, v, cb);
840
}
841
842
static const char commit_utf8_warn[] =
@@ -864,7 +864,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
864
unsigned char commit_sha1[20];
865
struct ref_lock *ref_lock;
866
867
- git_config(git_commit_config);
867
+ git_config(git_commit_config, NULL);
868
869
argc = parse_and_validate_options(argc, argv, builtin_commit_usage);
870
builtin-config.c
+14
-12
@@ -18,7 +18,7 @@ static char key_delim = ' ';
18
static char term = '\n';
19
static enum { T_RAW, T_INT, T_BOOL, T_BOOL_OR_INT } type = T_RAW;
20
21
-static int show_all_config(const char *key_, const char *value_)
21
+static int show_all_config(const char *key_, const char *value_, void *cb)
22
{
23
if (value_)
24
printf("%s%c%s%c", key_, delim, value_, term);
@@ -27,7 +27,7 @@ static int show_all_config(const char *key_, const char *value_)
27
return 0;
28
}
29
30
-static int show_config(const char* key_, const char* value_)
30
+static int show_config(const char* key_, const char* value_, void *cb)
31
{
32
char value[256];
33
const char *vptr = value;
@@ -121,14 +121,14 @@ static int get_value(const char* key_, const char* regex_)
121
}
122
123
if (do_all && system_wide)
124
- git_config_from_file(show_config, system_wide);
124
+ git_config_from_file(show_config, system_wide, NULL);
125
if (do_all && global)
126
- git_config_from_file(show_config, global);
127
- git_config_from_file(show_config, local);
126
+ git_config_from_file(show_config, global, NULL);
127
+ git_config_from_file(show_config, local, NULL);
128
if (!do_all && !seen && global)
129
- git_config_from_file(show_config, global);
129
+ git_config_from_file(show_config, global, NULL);
130
if (!do_all && !seen && system_wide)
131
- git_config_from_file(show_config, system_wide);
131
+ git_config_from_file(show_config, system_wide, NULL);
132
133
free(key);
134
if (regexp) {
@@ -182,7 +182,7 @@ static int get_color_found;
182
static const char *get_color_slot;
183
static char parsed_color[COLOR_MAXLEN];
184
185
-static int git_get_color_config(const char *var, const char *value)
185
+static int git_get_color_config(const char *var, const char *value, void *cb)
186
{
187
if (!strcmp(var, get_color_slot)) {
188
if (!value)
@@ -218,7 +218,7 @@ static int get_color(int argc, const char **argv)
218
219
get_color_found = 0;
220
parsed_color[0] = '\0';
221
- git_config(git_get_color_config);
221
+ git_config(git_get_color_config, NULL);
222
223
if (!get_color_found && def_color)
224
color_parse(def_color, "command line", parsed_color);
@@ -230,7 +230,8 @@ static int get_color(int argc, const char **argv)
230
static int stdout_is_tty;
231
static int get_colorbool_found;
232
static int get_diff_color_found;
233
-static int git_get_colorbool_config(const char *var, const char *value)
233
+static int git_get_colorbool_config(const char *var, const char *value,
234
+ void *cb)
235
{
236
if (!strcmp(var, get_color_slot)) {
237
get_colorbool_found =
@@ -265,7 +266,7 @@ static int get_colorbool(int argc, const char **argv)
266
get_colorbool_found = -1;
267
get_diff_color_found = -1;
268
get_color_slot = argv[0];
268
- git_config(git_get_colorbool_config);
269
+ git_config(git_get_colorbool_config, NULL);
270
271
if (get_colorbool_found < 0) {
272
if (!strcmp(get_color_slot, "color.diff"))
@@ -298,7 +299,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
299
else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l")) {
300
if (argc != 2)
301
usage(git_config_set_usage);
301
- if (git_config(show_all_config) < 0 && file && errno)
302
+ if (git_config(show_all_config, NULL) < 0 &&
303
+ file && errno)
304
die("unable to read config file %s: %s", file,
305
strerror(errno));
306
return 0;
builtin-diff-files.c
+1
-1
@@ -21,7 +21,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
21
22
prefix = setup_git_directory_gently(&nongit);
23
init_revisions(&rev, prefix);
24
- git_config(git_diff_basic_config); /* no "diff" UI options */
24
+ git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
25
rev.abbrev = 0;
26
27
if (!setup_diff_no_index(&rev, argc, argv, nongit, prefix))
builtin-diff-index.c
+1
-1
@@ -17,7 +17,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
17
int result;
18
19
init_revisions(&rev, prefix);
20
- git_config(git_diff_basic_config); /* no "diff" UI options */
20
+ git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
21
rev.abbrev = 0;
22
23
argc = setup_revisions(argc, argv, &rev, NULL);
builtin-diff-tree.c
+1
-1
@@ -68,7 +68,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
68
int read_stdin = 0;
69
70
init_revisions(opt, prefix);
71
- git_config(git_diff_basic_config); /* no "diff" UI options */
71
+ git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
72
nr_sha1 = 0;
73
opt->abbrev = 0;
74
opt->diff = 1;
builtin-diff.c
+1
-1
@@ -234,7 +234,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
234
*/
235
236
prefix = setup_git_directory_gently(&nongit);
237
- git_config(git_diff_ui_config);
237
+ git_config(git_diff_ui_config, NULL);
238
239
if (diff_use_color_default == -1)
240
diff_use_color_default = git_use_color_default;
builtin-fast-export.c
+1
-1
@@ -372,7 +372,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
372
};
373
374
/* we handle encodings */
375
- git_config(git_default_config);
375
+ git_config(git_default_config, NULL);
376
377
init_revisions(&revs, prefix);
378
argc = setup_revisions(argc, argv, &revs, NULL);
builtin-fetch-pack.c
+3
-3
@@ -635,7 +635,7 @@ static int remove_duplicates(int nr_heads, char **heads)
635
return dst;
636
}
637
638
-static int fetch_pack_config(const char *var, const char *value)
638
+static int fetch_pack_config(const char *var, const char *value, void *cb)
639
{
640
if (strcmp(var, "fetch.unpacklimit") == 0) {
641
fetch_unpack_limit = git_config_int(var, value);
@@ -647,7 +647,7 @@ static int fetch_pack_config(const char *var, const char *value)
647
return 0;
648
}
649
650
- return git_default_config(var, value);
650
+ return git_default_config(var, value, cb);
651
}
652
653
static struct lock_file lock;
@@ -657,7 +657,7 @@ static void fetch_pack_setup(void)
657
static int did_setup;
658
if (did_setup)
659
return;
660
- git_config(fetch_pack_config);
660
+ git_config(fetch_pack_config, NULL);
661
if (0 <= transfer_unpack_limit)
662
unpack_limit = transfer_unpack_limit;
663
else if (0 <= fetch_unpack_limit)
builtin-fmt-merge-msg.c
+2
-2
@@ -10,7 +10,7 @@ static const char *fmt_merge_msg_usage =
10
11
static int merge_summary;
12
13
-static int fmt_merge_msg_config(const char *key, const char *value)
13
+static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
14
{
15
static int found_merge_log = 0;
16
if (!strcmp("merge.log", key)) {
@@ -260,7 +260,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
260
unsigned char head_sha1[20];
261
const char *current_branch;
262
263
- git_config(fmt_merge_msg_config);
263
+ git_config(fmt_merge_msg_config, NULL);
264
265
while (argc > 1) {
266
if (!strcmp(argv[1], "--log") || !strcmp(argv[1], "--summary"))
builtin-gc.c
+3
-3
@@ -35,7 +35,7 @@ static const char *argv_repack[MAX_ADD] = {"repack", "-d", "-l", NULL};
35
static const char *argv_prune[] = {"prune", "--expire", NULL, NULL};
36
static const char *argv_rerere[] = {"rerere", "gc", NULL};
37
38
-static int gc_config(const char *var, const char *value)
38
+static int gc_config(const char *var, const char *value, void *cb)
39
{
40
if (!strcmp(var, "gc.packrefs")) {
41
if (value && !strcmp(value, "notbare"))
@@ -67,7 +67,7 @@ static int gc_config(const char *var, const char *value)
67
prune_expire = xstrdup(value);
68
return 0;
69
}
70
- return git_default_config(var, value);
70
+ return git_default_config(var, value, cb);
71
}
72
73
static void append_option(const char **cmd, const char *opt, int max_length)
@@ -226,7 +226,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
226
OPT_END()
227
};
228
229
- git_config(gc_config);
229
+ git_config(gc_config, NULL);
230
231
if (pack_refs < 0)
232
pack_refs = !is_bare_repository();
builtin-http-fetch.c
+1
-1
@@ -18,7 +18,7 @@ int cmd_http_fetch(int argc, const char **argv, const char *prefix)
18
int get_verbosely = 0;
19
int get_recover = 0;
20
21
- git_config(git_default_config);
21
+ git_config(git_default_config, NULL);
22
23
while (arg < argc && argv[arg][0] == '-') {
24
if (argv[arg][1] == 't') {
builtin-init-db.c
+2
-2
@@ -142,7 +142,7 @@ static void copy_templates(const char *git_dir, int len, const char *template_di
142
strcpy(template_path + template_len, "config");
143
repository_format_version = 0;
144
git_config_from_file(check_repository_format_version,
145
- template_path);
145
+ template_path, NULL);
146
template_path[template_len] = 0;
147
148
if (repository_format_version &&
@@ -197,7 +197,7 @@ static int create_default_files(const char *git_dir, const char *template_path)
197
path[len] = 0;
198
copy_templates(path, len, template_path);
199
200
- git_config(git_default_config);
200
+ git_config(git_default_config, NULL);
201
202
/*
203
* We would have created the above under user's umask -- under
builtin-log.c
+9
-9
@@ -222,7 +222,7 @@ static int cmd_log_walk(struct rev_info *rev)
222
return 0;
223
}
224
225
-static int git_log_config(const char *var, const char *value)
225
+static int git_log_config(const char *var, const char *value, void *cb)
226
{
227
if (!strcmp(var, "format.pretty"))
228
return git_config_string(&fmt_pretty, var, value);
@@ -236,14 +236,14 @@ static int git_log_config(const char *var, const char *value)
236
default_show_root = git_config_bool(var, value);
237
return 0;
238
}
239
- return git_diff_ui_config(var, value);
239
+ return git_diff_ui_config(var, value, cb);
240
}
241
242
int cmd_whatchanged(int argc, const char **argv, const char *prefix)
243
{
244
struct rev_info rev;
245
246
- git_config(git_log_config);
246
+ git_config(git_log_config, NULL);
247
248
if (diff_use_color_default == -1)
249
diff_use_color_default = git_use_color_default;
@@ -319,7 +319,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
319
struct object_array_entry *objects;
320
int i, count, ret = 0;
321
322
- git_config(git_log_config);
322
+ git_config(git_log_config, NULL);
323
324
if (diff_use_color_default == -1)
325
diff_use_color_default = git_use_color_default;
@@ -383,7 +383,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
383
{
384
struct rev_info rev;
385
386
- git_config(git_log_config);
386
+ git_config(git_log_config, NULL);
387
388
if (diff_use_color_default == -1)
389
diff_use_color_default = git_use_color_default;
@@ -416,7 +416,7 @@ int cmd_log(int argc, const char **argv, const char *prefix)
416
{
417
struct rev_info rev;
418
419
- git_config(git_log_config);
419
+ git_config(git_log_config, NULL);
420
421
if (diff_use_color_default == -1)
422
diff_use_color_default = git_use_color_default;
@@ -471,7 +471,7 @@ static void add_header(const char *value)
471
extra_hdr[extra_hdr_nr++] = xstrndup(value, len);
472
}
473
474
-static int git_format_config(const char *var, const char *value)
474
+static int git_format_config(const char *var, const char *value, void *cb)
475
{
476
if (!strcmp(var, "format.headers")) {
477
if (!value)
@@ -497,7 +497,7 @@ static int git_format_config(const char *var, const char *value)
497
return 0;
498
}
499
500
- return git_log_config(var, value);
500
+ return git_log_config(var, value, cb);
501
}
502
503
@@ -764,7 +764,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
764
char *add_signoff = NULL;
765
struct strbuf buf;
766
767
- git_config(git_format_config);
767
+ git_config(git_format_config, NULL);
768
init_revisions(&rev, prefix);
769
rev.commit_format = CMIT_FMT_EMAIL;
770
rev.verbose_header = 1;
builtin-ls-files.c
+1
-1
@@ -437,7 +437,7 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
437
memset(&dir, 0, sizeof(dir));
438
if (prefix)
439
prefix_offset = strlen(prefix);
440
- git_config(git_default_config);
440
+ git_config(git_default_config, NULL);
441
442
for (i = 1; i < argc; i++) {
443
const char *arg = argv[i];
builtin-ls-tree.c
+1
-1
@@ -122,7 +122,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
122
unsigned char sha1[20];
123
struct tree *tree;
124
125
- git_config(git_default_config);
125
+ git_config(git_default_config, NULL);
126
ls_tree_prefix = prefix;
127
if (prefix && *prefix)
128
chomp_prefix = strlen(prefix);
builtin-mailinfo.c
+1
-1
@@ -962,7 +962,7 @@ int cmd_mailinfo(int argc, const char **argv, const char *prefix)
962
/* NEEDSWORK: might want to do the optional .git/ directory
963
* discovery
964
*/
965
- git_config(git_default_config);
965
+ git_config(git_default_config, NULL);
966
967
def_charset = (git_commit_encoding ? git_commit_encoding : "utf-8");
968
metainfo_charset = def_charset;
builtin-merge-base.c
+1
-1
@@ -28,7 +28,7 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix)
28
unsigned char rev1key[20], rev2key[20];
29
int show_all = 0;
30
31
- git_config(git_default_config);
31
+ git_config(git_default_config, NULL);
32
33
while (1 < argc && argv[1][0] == '-') {
34
const char *arg = argv[1];
builtin-merge-recursive.c
+3
-3
@@ -1336,7 +1336,7 @@ static struct commit *get_ref(const char *ref)
1336
return (struct commit *)object;
1337
}
1338
1339
-static int merge_config(const char *var, const char *value)
1339
+static int merge_config(const char *var, const char *value, void *cb)
1340
{
1341
if (!strcasecmp(var, "merge.verbosity")) {
1342
verbosity = git_config_int(var, value);
@@ -1346,7 +1346,7 @@ static int merge_config(const char *var, const char *value)
1346
rename_limit = git_config_int(var, value);
1347
return 0;
1348
}
1349
- return git_default_config(var, value);
1349
+ return git_default_config(var, value, cb);
1350
}
1351
1352
int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
@@ -1367,7 +1367,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
1367
subtree_merge = 1;
1368
}
1369
1370
- git_config(merge_config);
1370
+ git_config(merge_config, NULL);
1371
if (getenv("GIT_MERGE_VERBOSITY"))
1372
verbosity = strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10);
1373
builtin-mv.c
+1
-1
@@ -81,7 +81,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
81
struct path_list deleted = {NULL, 0, 0, 0};
82
struct path_list changed = {NULL, 0, 0, 0};
83
84
- git_config(git_default_config);
84
+ git_config(git_default_config, NULL);
85
86
newfd = hold_locked_index(&lock_file, 1);
87
if (read_cache() < 0)
builtin-name-rev.c
+1
-1
@@ -195,7 +195,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
195
OPT_END(),
196
};
197
198
- git_config(git_default_config);
198
+ git_config(git_default_config, NULL);
199
argc = parse_options(argc, argv, opts, name_rev_usage, 0);
200
if (!!all + !!transform_stdin + !!argc > 1) {
201
error("Specify either a list, or --all, not both!");
builtin-pack-objects.c
+3
-3
@@ -1718,7 +1718,7 @@ static void prepare_pack(int window, int depth)
1718
free(delta_list);
1719
}
1720
1721
-static int git_pack_config(const char *k, const char *v)
1721
+static int git_pack_config(const char *k, const char *v, void *cb)
1722
{
1723
if(!strcmp(k, "pack.window")) {
1724
window = git_config_int(k, v);
@@ -1771,7 +1771,7 @@ static int git_pack_config(const char *k, const char *v)
1771
pack_size_limit_cfg = git_config_ulong(k, v);
1772
return 0;
1773
}
1774
- return git_default_config(k, v);
1774
+ return git_default_config(k, v, cb);
1775
}
1776
1777
static void read_object_list_from_stdin(void)
@@ -1963,7 +1963,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
1963
rp_av[1] = "--objects"; /* --thin will make it --objects-edge */
1964
rp_ac = 2;
1965
1966
- git_config(git_pack_config);
1966
+ git_config(git_pack_config, NULL);
1967
if (!pack_compression_seen && core_compression_seen)
1968
pack_compression_level = core_compression_level;
1969
builtin-read-tree.c
+1
-3
@@ -104,12 +104,10 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
104
opts.src_index = &the_index;
105
opts.dst_index = &the_index;
106
107
- git_config(git_default_config);
107
+ git_config(git_default_config, NULL);
108
109
newfd = hold_locked_index(&lock_file, 1);
110
111
- git_config(git_default_config);
112
-
111
for (i = 1; i < argc; i++) {
112
const char *arg = argv[i];
113
builtin-reflog.c
+3
-3
@@ -329,7 +329,7 @@ static int collect_reflog(const char *ref, const unsigned char *sha1, int unused
329
return 0;
330
}
331
332
-static int reflog_expire_config(const char *var, const char *value)
332
+static int reflog_expire_config(const char *var, const char *value, void *cb)
333
{
334
if (!strcmp(var, "gc.reflogexpire")) {
335
if (!value)
@@ -343,7 +343,7 @@ static int reflog_expire_config(const char *var, const char *value)
343
default_reflog_expire_unreachable = approxidate(value);
344
return 0;
345
}
346
- return git_default_config(var, value);
346
+ return git_default_config(var, value, cb);
347
}
348
349
static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
@@ -352,7 +352,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
352
unsigned long now = time(NULL);
353
int i, status, do_all;
354
355
- git_config(reflog_expire_config);
355
+ git_config(reflog_expire_config, NULL);
356
357
save_commit_buffer = 0;
358
do_all = status = 0;
builtin-remote.c
+4
-4
@@ -153,7 +153,7 @@ struct branch_info {
153
154
static struct path_list branch_list;
155
156
-static int config_read_branches(const char *key, const char *value)
156
+static int config_read_branches(const char *key, const char *value, void *cb)
157
{
158
if (!prefixcmp(key, "branch.")) {
159
char *name;
@@ -200,7 +200,7 @@ static void read_branches(void)
200
{
201
if (branch_list.nr)
202
return;
203
- git_config(config_read_branches);
203
+ git_config(config_read_branches, NULL);
204
sort_path_list(&branch_list);
205
}
206
@@ -514,7 +514,7 @@ struct remote_group {
514
struct path_list *list;
515
} remote_group;
516
517
-static int get_remote_group(const char *key, const char *value)
517
+static int get_remote_group(const char *key, const char *value, void *cb)
518
{
519
if (!prefixcmp(key, "remotes.") &&
520
!strcmp(key + 8, remote_group.name)) {
@@ -546,7 +546,7 @@ static int update(int argc, const char **argv)
546
remote_group.list = &list;
547
for (i = 1; i < argc; i++) {
548
remote_group.name = argv[i];
549
- result = git_config(get_remote_group);
549
+ result = git_config(get_remote_group, NULL);
550
}
551
552
if (!result && !list.nr && argc == 2 && !strcmp(argv[1], "default"))
builtin-rerere.c
+3
-3
@@ -339,7 +339,7 @@ tail_optimization:
339
return write_rr(rr, fd);
340
}
341
342
-static int git_rerere_config(const char *var, const char *value)
342
+static int git_rerere_config(const char *var, const char *value, void *cb)
343
{
344
if (!strcmp(var, "gc.rerereresolved"))
345
cutoff_resolve = git_config_int(var, value);
@@ -348,7 +348,7 @@ static int git_rerere_config(const char *var, const char *value)
348
else if (!strcmp(var, "rerere.enabled"))
349
rerere_enabled = git_config_bool(var, value);
350
else
351
- return git_default_config(var, value);
351
+ return git_default_config(var, value, cb);
352
return 0;
353
}
354
@@ -376,7 +376,7 @@ static int setup_rerere(struct path_list *merge_rr)
376
{
377
int fd;
378
379
- git_config(git_rerere_config);
379
+ git_config(git_rerere_config, NULL);
380
if (!is_rerere_enabled())
381
return -1;
382
builtin-reset.c
+1
-1
@@ -186,7 +186,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
186
OPT_END()
187
};
188
189
- git_config(git_default_config);
189
+ git_config(git_default_config, NULL);
190
191
argc = parse_options(argc, argv, options, git_reset_usage,
192
PARSE_OPT_KEEP_DASHDASH);
builtin-rev-list.c
+1
-1
@@ -546,7 +546,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
546
int bisect_find_all = 0;
547
int quiet = 0;
548
549
- git_config(git_default_config);
549
+ git_config(git_default_config, NULL);
550
init_revisions(&revs, prefix);
551
revs.abbrev = 0;
552
revs.commit_format = CMIT_FMT_UNSPECIFIED;
builtin-rev-parse.c
+1
-1
@@ -381,7 +381,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
381
return cmd_parseopt(argc - 1, argv + 1, prefix);
382
383
prefix = setup_git_directory();
384
- git_config(git_default_config);
384
+ git_config(git_default_config, NULL);
385
for (i = 1; i < argc; i++) {
386
const char *arg = argv[i];
387
builtin-revert.c
+1
-1
@@ -269,7 +269,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
269
const char *message, *encoding;
270
const char *defmsg = xstrdup(git_path("MERGE_MSG"));
271
272
- git_config(git_default_config);
272
+ git_config(git_default_config, NULL);
273
me = action == REVERT ? "revert" : "cherry-pick";
274
setenv(GIT_REFLOG_ACTION, me, 0);
275
parse_args(argc, argv);
builtin-rm.c
+1
-1
@@ -144,7 +144,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
144
const char **pathspec;
145
char *seen;
146
147
- git_config(git_default_config);
147
+ git_config(git_default_config, NULL);
148
149
newfd = hold_locked_index(&lock_file, 1);
150
builtin-show-branch.c
+3
-3
@@ -533,7 +533,7 @@ static void append_one_rev(const char *av)
533
die("bad sha1 reference %s", av);
534
}
535
536
-static int git_show_branch_config(const char *var, const char *value)
536
+static int git_show_branch_config(const char *var, const char *value, void *cb)
537
{
538
if (!strcmp(var, "showbranch.default")) {
539
if (!value)
@@ -547,7 +547,7 @@ static int git_show_branch_config(const char *var, const char *value)
547
return 0;
548
}
549
550
- return git_default_config(var, value);
550
+ return git_default_config(var, value, cb);
551
}
552
553
static int omit_in_dense(struct commit *commit, struct commit **rev, int n)
@@ -611,7 +611,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
611
int reflog = 0;
612
const char *reflog_base = NULL;
613
614
- git_config(git_show_branch_config);
614
+ git_config(git_show_branch_config, NULL);
615
616
/* If nothing is specified, try the default first */
617
if (ac == 1 && default_num) {
builtin-symbolic-ref.c
+1
-1
@@ -35,7 +35,7 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
35
OPT_END(),
36
};
37
38
- git_config(git_default_config);
38
+ git_config(git_default_config, NULL);
39
argc = parse_options(argc, argv, options, git_symbolic_ref_usage, 0);
40
if (msg &&!*msg)
41
die("Refusing to perform update with empty message");
builtin-tag.c
+3
-3
@@ -256,7 +256,7 @@ static void set_signingkey(const char *value)
256
die("signing key value too long (%.10s...)", value);
257
}
258
259
-static int git_tag_config(const char *var, const char *value)
259
+static int git_tag_config(const char *var, const char *value, void *cb)
260
{
261
if (!strcmp(var, "user.signingkey")) {
262
if (!value)
@@ -265,7 +265,7 @@ static int git_tag_config(const char *var, const char *value)
265
return 0;
266
}
267
268
- return git_default_config(var, value);
268
+ return git_default_config(var, value, cb);
269
}
270
271
static void write_tag_body(int fd, const unsigned char *sha1)
@@ -408,7 +408,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
408
OPT_END()
409
};
410
411
- git_config(git_tag_config);
411
+ git_config(git_tag_config, NULL);
412
413
argc = parse_options(argc, argv, options, git_tag_usage, 0);
414
builtin-unpack-objects.c
+1
-1
@@ -493,7 +493,7 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
493
int i;
494
unsigned char sha1[20];
495
496
- git_config(git_default_config);
496
+ git_config(git_default_config, NULL);
497
498
quiet = !isatty(2);
499
builtin-update-index.c
+1
-1
@@ -567,7 +567,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
567
int lock_error = 0;
568
struct lock_file *lock_file;
569
570
- git_config(git_default_config);
570
+ git_config(git_default_config, NULL);
571
572
/* We can't free this memory, it becomes part of a linked list parsed atexit() */
573
lock_file = xcalloc(1, sizeof(struct lock_file));
builtin-update-ref.c
+1
-1
@@ -22,7 +22,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
22
OPT_END(),
23
};
24
25
- git_config(git_default_config);
25
+ git_config(git_default_config, NULL);
26
argc = parse_options(argc, argv, options, git_update_ref_usage, 0);
27
if (msg && !*msg)
28
die("Refusing to perform update with empty message.");
builtin-verify-pack.c
+1
-1
@@ -55,7 +55,7 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix)
55
int no_more_options = 0;
56
int nothing_done = 1;
57
58
- git_config(git_default_config);
58
+ git_config(git_default_config, NULL);
59
while (1 < argc) {
60
if (!no_more_options && argv[1][0] == '-') {
61
if (!strcmp("-v", argv[1]))
builtin-verify-tag.c
+1
-1
@@ -90,7 +90,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
90
{
91
int i = 1, verbose = 0, had_error = 0;
92
93
- git_config(git_default_config);
93
+ git_config(git_default_config, NULL);
94
95
if (argc == 1)
96
usage(builtin_verify_tag_usage);
builtin-write-tree.c
+1
-1
@@ -18,7 +18,7 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
18
unsigned char sha1[20];
19
const char *me = "git-write-tree";
20
21
- git_config(git_default_config);
21
+ git_config(git_default_config, NULL);
22
while (1 < argc) {
23
const char *arg = argv[1];
24
if (!strcmp(arg, "--missing-ok"))
cache.h
+5
-5
@@ -711,10 +711,10 @@ extern int matches_pack_name(struct packed_git *p, const char *name);
711
/* Dumb servers support */
712
extern int update_server_info(int);
713
714
-typedef int (*config_fn_t)(const char *, const char *);
715
-extern int git_default_config(const char *, const char *);
716
-extern int git_config_from_file(config_fn_t fn, const char *);
717
-extern int git_config(config_fn_t fn);
714
+typedef int (*config_fn_t)(const char *, const char *, void *);
715
+extern int git_default_config(const char *, const char *, void *);
716
+extern int git_config_from_file(config_fn_t fn, const char *, void *);
717
+extern int git_config(config_fn_t fn, void *);
718
extern int git_parse_long(const char *, long *);
719
extern int git_parse_ulong(const char *, unsigned long *);
720
extern int git_config_int(const char *, const char *);
@@ -726,7 +726,7 @@ extern int git_config_set(const char *, const char *);
726
extern int git_config_set_multivar(const char *, const char *, const char *, int);
727
extern int git_config_rename_section(const char *, const char *);
728
extern const char *git_etc_gitconfig(void);
729
-extern int check_repository_format_version(const char *var, const char *value);
729
+extern int check_repository_format_version(const char *var, const char *value, void *cb);
730
extern int git_env_bool(const char *, int);
731
extern int git_config_system(void);
732
extern int git_config_global(void);
color.c
+2
-2
@@ -145,14 +145,14 @@ int git_config_colorbool(const char *var, const char *value, int stdout_is_tty)
145
return 0;
146
}
147
148
-int git_color_default_config(const char *var, const char *value)
148
+int git_color_default_config(const char *var, const char *value, void *cb)
149
{
150
if (!strcmp(var, "color.ui")) {
151
git_use_color_default = git_config_colorbool(var, value, -1);
152
return 0;
153
}
154
155
- return git_default_config(var, value);
155
+ return git_default_config(var, value, cb);
156
}
157
158
static int color_vfprintf(FILE *fp, const char *color, const char *fmt,
color.h
+1
-1
@@ -13,7 +13,7 @@ extern int git_use_color_default;
13
/*
14
* Use this instead of git_default_config if you need the value of color.ui.
15
*/
16
-int git_color_default_config(const char *var, const char *value);
16
+int git_color_default_config(const char *var, const char *value, void *cb);
17
18
int git_config_colorbool(const char *var, const char *value, int stdout_is_tty);
19
void color_parse(const char *var, const char *value, char *dst);
config.c
+14
-13
@@ -111,7 +111,7 @@ static inline int iskeychar(int c)
111
return isalnum(c) || c == '-';
112
}
113
114
-static int get_value(config_fn_t fn, char *name, unsigned int len)
114
+static int get_value(config_fn_t fn, void *data, char *name, unsigned int len)
115
{
116
int c;
117
char *value;
@@ -139,7 +139,7 @@ static int get_value(config_fn_t fn, char *name, unsigned int len)
139
if (!value)
140
return -1;
141
}
142
- return fn(name, value);
142
+ return fn(name, value, data);
143
}
144
145
static int get_extended_base_var(char *name, int baselen, int c)
@@ -197,7 +197,7 @@ static int get_base_var(char *name)
197
}
198
}
199
200
-static int git_parse_file(config_fn_t fn)
200
+static int git_parse_file(config_fn_t fn, void *data)
201
{
202
int comment = 0;
203
int baselen = 0;
@@ -228,7 +228,7 @@ static int git_parse_file(config_fn_t fn)
228
if (!isalpha(c))
229
break;
230
var[baselen] = tolower(c);
231
- if (get_value(fn, var, baselen+1) < 0)
231
+ if (get_value(fn, data, var, baselen+1) < 0)
232
break;
233
}
234
die("bad config file line %d in %s", config_linenr, config_file_name);
@@ -332,7 +332,7 @@ int git_config_string(const char **dest, const char *var, const char *value)
332
return 0;
333
}
334
335
-int git_default_config(const char *var, const char *value)
335
+int git_default_config(const char *var, const char *value, void *dummy)
336
{
337
/* This needs a better name */
338
if (!strcmp(var, "core.filemode")) {
@@ -512,7 +512,7 @@ int git_default_config(const char *var, const char *value)
512
return 0;
513
}
514
515
-int git_config_from_file(config_fn_t fn, const char *filename)
515
+int git_config_from_file(config_fn_t fn, const char *filename, void *data)
516
{
517
int ret;
518
FILE *f = fopen(filename, "r");
@@ -523,7 +523,7 @@ int git_config_from_file(config_fn_t fn, const char *filename)
523
config_file_name = filename;
524
config_linenr = 1;
525
config_file_eof = 0;
526
- ret = git_parse_file(fn);
526
+ ret = git_parse_file(fn, data);
527
fclose(f);
528
config_file_name = NULL;
529
}
@@ -561,7 +561,7 @@ int git_config_global(void)
561
return !git_env_bool("GIT_CONFIG_NOGLOBAL", 0);
562
}
563
564
-int git_config(config_fn_t fn)
564
+int git_config(config_fn_t fn, void *data)
565
{
566
int ret = 0;
567
char *repo_config = NULL;
@@ -574,7 +574,8 @@ int git_config(config_fn_t fn)
574
filename = getenv(CONFIG_ENVIRONMENT);
575
if (!filename) {
576
if (git_config_system() && !access(git_etc_gitconfig(), R_OK))
577
- ret += git_config_from_file(fn, git_etc_gitconfig());
577
+ ret += git_config_from_file(fn, git_etc_gitconfig(),
578
+ data);
579
home = getenv("HOME");
580
filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
581
if (!filename)
@@ -584,11 +585,11 @@ int git_config(config_fn_t fn)
585
if (git_config_global() && home) {
586
char *user_config = xstrdup(mkpath("%s/.gitconfig", home));
587
if (!access(user_config, R_OK))
587
- ret = git_config_from_file(fn, user_config);
588
+ ret = git_config_from_file(fn, user_config, data);
589
free(user_config);
590
}
591
591
- ret += git_config_from_file(fn, filename);
592
+ ret += git_config_from_file(fn, filename, data);
593
free(repo_config);
594
return ret;
595
}
@@ -618,7 +619,7 @@ static int matches(const char* key, const char* value)
619
!regexec(store.value_regex, value, 0, NULL, 0)));
620
}
621
621
-static int store_aux(const char* key, const char* value)
622
+static int store_aux(const char* key, const char* value, void *cb)
623
{
624
const char *ep;
625
size_t section_len;
@@ -947,7 +948,7 @@ int git_config_set_multivar(const char* key, const char* value,
948
* As a side effect, we make sure to transform only a valid
949
* existing config file.
950
*/
950
- if (git_config_from_file(store_aux, config_filename)) {
951
+ if (git_config_from_file(store_aux, config_filename, NULL)) {
952
error("invalid config file %s", config_filename);
953
free(store.key);
954
if (store.value_regex != NULL) {
connect.c
+4
-3
@@ -360,7 +360,8 @@ static char *git_proxy_command;
360
static const char *rhost_name;
361
static int rhost_len;
362
363
-static int git_proxy_command_options(const char *var, const char *value)
363
+static int git_proxy_command_options(const char *var, const char *value,
364
+ void *cb)
365
{
366
if (!strcmp(var, "core.gitproxy")) {
367
const char *for_pos;
@@ -404,7 +405,7 @@ static int git_proxy_command_options(const char *var, const char *value)
405
return 0;
406
}
407
407
- return git_default_config(var, value);
408
+ return git_default_config(var, value, cb);
409
}
410
411
static int git_use_proxy(const char *host)
@@ -412,7 +413,7 @@ static int git_use_proxy(const char *host)
413
rhost_name = host;
414
rhost_len = strlen(host);
415
git_proxy_command = getenv("GIT_PROXY_COMMAND");
415
- git_config(git_proxy_command_options);
416
+ git_config(git_proxy_command_options, NULL);
417
rhost_name = NULL;
418
return (git_proxy_command && *git_proxy_command);
419
}
convert.c
+2
-2
@@ -323,7 +323,7 @@ static struct convert_driver {
323
char *clean;
324
} *user_convert, **user_convert_tail;
325
326
-static int read_convert_config(const char *var, const char *value)
326
+static int read_convert_config(const char *var, const char *value, void *cb)
327
{
328
const char *ep, *name;
329
int namelen;
@@ -385,7 +385,7 @@ static void setup_convert_check(struct git_attr_check *check)
385
attr_ident = git_attr("ident", 5);
386
attr_filter = git_attr("filter", 6);
387
user_convert_tail = &user_convert;
388
- git_config(read_convert_config);
388
+ git_config(read_convert_config, NULL);
389
}
390
check[0].attr = attr_crlf;
391
check[1].attr = attr_ident;
daemon.c
+2
-2
@@ -306,7 +306,7 @@ struct daemon_service {
306
static struct daemon_service *service_looking_at;
307
static int service_enabled;
308
309
-static int git_daemon_config(const char *var, const char *value)
309
+static int git_daemon_config(const char *var, const char *value, void *cb)
310
{
311
if (!prefixcmp(var, "daemon.") &&
312
!strcmp(var + 7, service_looking_at->config_name)) {
@@ -356,7 +356,7 @@ static int run_service(struct interp *itable, struct daemon_service *service)
356
if (service->overridable) {
357
service_looking_at = service;
358
service_enabled = -1;
359
- git_config(git_daemon_config);
359
+ git_config(git_daemon_config, NULL);
360
if (0 <= service_enabled)
361
enabled = service_enabled;
362
}
diff.c
+4
-4
@@ -129,7 +129,7 @@ static int parse_funcname_pattern(const char *var, const char *ep, const char *v
129
* never be affected by the setting of diff.renames
130
* the user happens to have in the configuration file.
131
*/
132
-int git_diff_ui_config(const char *var, const char *value)
132
+int git_diff_ui_config(const char *var, const char *value, void *cb)
133
{
134
if (!strcmp(var, "diff.renamelimit")) {
135
diff_rename_limit_default = git_config_int(var, value);
@@ -166,10 +166,10 @@ int git_diff_ui_config(const char *var, const char *value)
166
return parse_lldiff_command(var, ep, value);
167
}
168
169
- return git_diff_basic_config(var, value);
169
+ return git_diff_basic_config(var, value, cb);
170
}
171
172
-int git_diff_basic_config(const char *var, const char *value)
172
+int git_diff_basic_config(const char *var, const char *value, void *cb)
173
{
174
if (!prefixcmp(var, "diff.color.") || !prefixcmp(var, "color.diff.")) {
175
int slot = parse_diff_color_slot(var, 11);
@@ -190,7 +190,7 @@ int git_diff_basic_config(const char *var, const char *value)
190
}
191
}
192
193
- return git_color_default_config(var, value);
193
+ return git_color_default_config(var, value, cb);
194
}
195
196
static char *quote_two(const char *one, const char *two)
diff.h
+2
-2
@@ -180,8 +180,8 @@ extern void diff_unmerge(struct diff_options *,
180
#define DIFF_SETUP_USE_CACHE 2
181
#define DIFF_SETUP_USE_SIZE_CACHE 4
182
183
-extern int git_diff_basic_config(const char *var, const char *value);
184
-extern int git_diff_ui_config(const char *var, const char *value);
183
+extern int git_diff_basic_config(const char *var, const char *value, void *cb);
184
+extern int git_diff_ui_config(const char *var, const char *value, void *cb);
185
extern int diff_use_color_default;
186
extern void diff_setup(struct diff_options *);
187
extern int diff_opt_parse(struct diff_options *, const char **, int);
fast-import.c
+3
-3
@@ -2352,7 +2352,7 @@ static void import_marks(const char *input_file)
2352
fclose(f);
2353
}
2354
2355
-static int git_pack_config(const char *k, const char *v)
2355
+static int git_pack_config(const char *k, const char *v, void *cb)
2356
{
2357
if (!strcmp(k, "pack.depth")) {
2358
max_depth = git_config_int(k, v);
@@ -2370,7 +2370,7 @@ static int git_pack_config(const char *k, const char *v)
2370
pack_compression_seen = 1;
2371
return 0;
2372
}
2373
- return git_default_config(k, v);
2373
+ return git_default_config(k, v, cb);
2374
}
2375
2376
static const char fast_import_usage[] =
@@ -2381,7 +2381,7 @@ int main(int argc, const char **argv)
2381
unsigned int i, show_stats = 1;
2382
2383
setup_git_directory();
2384
- git_config(git_pack_config);
2384
+ git_config(git_pack_config, NULL);
2385
if (!pack_compression_seen && core_compression_seen)
2386
pack_compression_level = core_compression_level;
2387
hash-object.c
+1
-1
@@ -43,7 +43,7 @@ int main(int argc, char **argv)
43
int no_more_flags = 0;
44
int hashstdin = 0;
45
46
- git_config(git_default_config);
46
+ git_config(git_default_config, NULL);
47
48
for (i = 1 ; i < argc; i++) {
49
if (!no_more_flags && argv[i][0] == '-') {
help.c
+3
-3
@@ -252,7 +252,7 @@ static int add_man_viewer_info(const char *var, const char *value)
252
return 0;
253
}
254
255
-static int git_help_config(const char *var, const char *value)
255
+static int git_help_config(const char *var, const char *value, void *cb)
256
{
257
if (!strcmp(var, "help.format")) {
258
if (!value)
@@ -269,7 +269,7 @@ static int git_help_config(const char *var, const char *value)
269
if (!prefixcmp(var, "man."))
270
return add_man_viewer_info(var, value);
271
272
- return git_default_config(var, value);
272
+ return git_default_config(var, value, cb);
273
}
274
275
/* most GUI terminals set COLUMNS (although some don't export it) */
@@ -641,7 +641,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
641
const char *alias;
642
643
setup_git_directory_gently(&nongit);
644
- git_config(git_help_config);
644
+ git_config(git_help_config, NULL);
645
646
argc = parse_options(argc, argv, builtin_help_options,
647
builtin_help_usage, 0);
http.c
+3
-3
@@ -90,7 +90,7 @@ static void process_curl_messages(void)
90
}
91
#endif
92
93
-static int http_options(const char *var, const char *value)
93
+static int http_options(const char *var, const char *value, void *cb)
94
{
95
if (!strcmp("http.sslverify", var)) {
96
if (curl_ssl_verify == -1) {
@@ -169,7 +169,7 @@ static int http_options(const char *var, const char *value)
169
}
170
171
/* Fall back on the default ones */
172
- return git_default_config(var, value);
172
+ return git_default_config(var, value, cb);
173
}
174
175
static CURL* get_curl_handle(void)
@@ -263,7 +263,7 @@ void http_init(struct remote *remote)
263
if (low_speed_time != NULL)
264
curl_low_speed_time = strtol(low_speed_time, NULL, 10);
265
266
- git_config(http_options);
266
+ git_config(http_options, NULL);
267
268
if (curl_ssl_verify == -1)
269
curl_ssl_verify = 1;
imap-send.c
+2
-2
@@ -1247,7 +1247,7 @@ static imap_server_conf_t server =
1247
static char *imap_folder;
1248
1249
static int
1250
-git_imap_config(const char *key, const char *val)
1250
+git_imap_config(const char *key, const char *val, void *cb)
1251
{
1252
char imap_key[] = "imap.";
1253
@@ -1296,7 +1296,7 @@ main(int argc, char **argv)
1296
/* init the random number generator */
1297
arc4_init();
1298
1299
- git_config( git_imap_config );
1299
+ git_config(git_imap_config, NULL);
1300
1301
if (!imap_folder) {
1302
fprintf( stderr, "no imap store specified\n" );
index-pack.c
+3
-3
@@ -765,7 +765,7 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
765
}
766
}
767
768
-static int git_index_pack_config(const char *k, const char *v)
768
+static int git_index_pack_config(const char *k, const char *v, void *cb)
769
{
770
if (!strcmp(k, "pack.indexversion")) {
771
pack_idx_default_version = git_config_int(k, v);
@@ -773,7 +773,7 @@ static int git_index_pack_config(const char *k, const char *v)
773
die("bad pack.indexversion=%d", pack_idx_default_version);
774
return 0;
775
}
776
- return git_default_config(k, v);
776
+ return git_default_config(k, v, cb);
777
}
778
779
int main(int argc, char **argv)
@@ -786,7 +786,7 @@ int main(int argc, char **argv)
786
struct pack_idx_entry **idx_objects;
787
unsigned char sha1[20];
788
789
- git_config(git_index_pack_config);
789
+ git_config(git_index_pack_config, NULL);
790
791
for (i = 1; i < argc; i++) {
792
char *arg = argv[i];
ll-merge.c
+2
-2
@@ -225,7 +225,7 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
225
static struct ll_merge_driver *ll_user_merge, **ll_user_merge_tail;
226
static const char *default_ll_merge;
227
228
-static int read_merge_config(const char *var, const char *value)
228
+static int read_merge_config(const char *var, const char *value, void *cb)
229
{
230
struct ll_merge_driver *fn;
231
const char *ep, *name;
@@ -309,7 +309,7 @@ static void initialize_ll_merge(void)
309
if (ll_user_merge_tail)
310
return;
311
ll_user_merge_tail = &ll_user_merge;
312
- git_config(read_merge_config);
312
+ git_config(read_merge_config, NULL);
313
}
314
315
static const struct ll_merge_driver *find_ll_merge_driver(const char *merge_attr)
pager.c
+1
-1
@@ -33,7 +33,7 @@ void setup_pager(void)
33
return;
34
if (!pager) {
35
if (!pager_program)
36
- git_config(git_default_config);
36
+ git_config(git_default_config, NULL);
37
pager = pager_program;
38
}
39
if (!pager)
receive-pack.c
+3
-3
@@ -19,7 +19,7 @@ static int report_status;
19
static char capabilities[] = " report-status delete-refs ";
20
static int capabilities_sent;
21
22
-static int receive_pack_config(const char *var, const char *value)
22
+static int receive_pack_config(const char *var, const char *value, void *cb)
23
{
24
if (strcmp(var, "receive.denynonfastforwards") == 0) {
25
deny_non_fast_forwards = git_config_bool(var, value);
@@ -41,7 +41,7 @@ static int receive_pack_config(const char *var, const char *value)
41
return 0;
42
}
43
44
- return git_default_config(var, value);
44
+ return git_default_config(var, value, cb);
45
}
46
47
static int show_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
@@ -489,7 +489,7 @@ int main(int argc, char **argv)
489
if (is_repository_shallow())
490
die("attempt to push into a shallow repository");
491
492
- git_config(receive_pack_config);
492
+ git_config(receive_pack_config, NULL);
493
494
if (0 <= transfer_unpack_limit)
495
unpack_limit = transfer_unpack_limit;
remote.c
+2
-2
@@ -288,7 +288,7 @@ static void read_branches_file(struct remote *remote)
288
remote->fetch_tags = 1; /* always auto-follow */
289
}
290
291
-static int handle_config(const char *key, const char *value)
291
+static int handle_config(const char *key, const char *value, void *cb)
292
{
293
const char *name;
294
const char *subkey;
@@ -410,7 +410,7 @@ static void read_config(void)
410
current_branch =
411
make_branch(head_ref + strlen("refs/heads/"), 0);
412
}
413
- git_config(handle_config);
413
+ git_config(handle_config, NULL);
414
alias_all_urls();
415
}
416
setup.c
+2
-2
@@ -300,7 +300,7 @@ void setup_work_tree(void)
300
301
static int check_repository_format_gently(int *nongit_ok)
302
{
303
- git_config(check_repository_format_version);
303
+ git_config(check_repository_format_version, NULL);
304
if (GIT_REPO_VERSION < repository_format_version) {
305
if (!nongit_ok)
306
die ("Expected git repo version <= %d, found %d",
@@ -524,7 +524,7 @@ int git_config_perm(const char *var, const char *value)
524
return i & 0666;
525
}
526
527
-int check_repository_format_version(const char *var, const char *value)
527
+int check_repository_format_version(const char *var, const char *value, void *cb)
528
{
529
if (strcmp(var, "core.repositoryformatversion") == 0)
530
repository_format_version = git_config_int(var, value);
unpack-file.c
+1
-1
@@ -31,7 +31,7 @@ int main(int argc, char **argv)
31
die("Not a valid object name %s", argv[1]);
32
33
setup_git_directory();
34
- git_config(git_default_config);
34
+ git_config(git_default_config, NULL);
35
36
puts(create_temp_file(sha1));
37
return 0;
var.c
+4
-4
@@ -39,13 +39,13 @@ static const char *read_var(const char *var)
39
return val;
40
}
41
42
-static int show_config(const char *var, const char *value)
42
+static int show_config(const char *var, const char *value, void *cb)
43
{
44
if (value)
45
printf("%s=%s\n", var, value);
46
else
47
printf("%s\n", var);
48
- return git_default_config(var, value);
48
+ return git_default_config(var, value, cb);
49
}
50
51
int main(int argc, char **argv)
@@ -60,11 +60,11 @@ int main(int argc, char **argv)
60
val = NULL;
61
62
if (strcmp(argv[1], "-l") == 0) {
63
- git_config(show_config);
63
+ git_config(show_config, NULL);
64
list_vars();
65
return 0;
66
}
67
- git_config(git_default_config);
67
+ git_config(git_default_config, NULL);
68
val = read_var(argv[1]);
69
if (!val)
70
usage(var_usage);
wt-status.c
+2
-2
@@ -362,7 +362,7 @@ void wt_status_print(struct wt_status *s)
362
}
363
}
364
365
-int git_status_config(const char *k, const char *v)
365
+int git_status_config(const char *k, const char *v, void *cb)
366
{
367
if (!strcmp(k, "status.submodulesummary")) {
368
int is_bool;
@@ -386,5 +386,5 @@ int git_status_config(const char *k, const char *v)
386
wt_status_relative_paths = git_config_bool(k, v);
387
return 0;
388
}
389
- return git_color_default_config(k, v);
389
+ return git_color_default_config(k, v, cb);
390
}
wt-status.h
+1
-1
@@ -27,7 +27,7 @@ struct wt_status {
27
const char *prefix;
28
};
29
30
-int git_status_config(const char *var, const char *value);
30
+int git_status_config(const char *var, const char *value, void *cb);
31
extern int wt_status_use_color;
32
extern int wt_status_relative_paths;
33
void wt_status_prepare(struct wt_status *s);