Raw
1 /*
2 * We put all the git config variables in this same object
3 * file, so that programs can link against the config parser
4 * without having to link against all the rest of git.
5 *
6 * In particular, no need to bring in libz etc unless needed,
7 * even if you might want to know where the git directory etc
8 * are.
9 */
10
11 #define USE_THE_REPOSITORY_VARIABLE
12
13 #include "git-compat-util.h"
14 #include "abspath.h"
15 #include "advice.h"
16 #include "attr.h"
17 #include "branch.h"
18 #include "color.h"
19 #include "convert.h"
20 #include "environment.h"
21 #include "gettext.h"
22 #include "git-zlib.h"
23 #include "ident.h"
24 #include "lockfile.h"
25 #include "mailmap.h"
26 #include "object-name.h"
27 #include "repository.h"
28 #include "config.h"
29 #include "refs.h"
30 #include "fmt-merge-msg.h"
31 #include "commit.h"
32 #include "strvec.h"
33 #include "pager.h"
34 #include "path.h"
35 #include "quote.h"
36 #include "chdir-notify.h"
37 #include "setup.h"
38 #include "ws.h"
39 #include "write-or-die.h"
40
41 static int pack_compression_seen;
42 static int zlib_compression_seen;
43
44 int trust_executable_bit = 1;
45 int has_symlinks = 1;
46 int minimum_abbrev = 4, default_abbrev = -1;
47 int ignore_case;
48 int assume_unchanged;
49 int is_bare_repository_cfg = -1; /* unspecified */
50 char *git_commit_encoding;
51 char *git_log_output_encoding;
52 char *apply_default_whitespace;
53 char *apply_default_ignorewhitespace;
54 int fsync_object_files = -1;
55 int use_fsync = -1;
56 enum fsync_method fsync_method = FSYNC_METHOD_DEFAULT;
57 enum fsync_component fsync_components = FSYNC_COMPONENTS_DEFAULT;
58 char *editor_program;
59 char *askpass_program;
60 char *excludes_file;
61 enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
62 enum eol core_eol = EOL_UNSET;
63 int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
64 char *check_roundtrip_encoding;
65 enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
66 enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
67 #ifndef OBJECT_CREATION_MODE
68 #define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS
69 #endif
70 enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE;
71 int grafts_keep_true_parents;
72 unsigned long pack_size_limit_cfg;
73
74 #ifndef PROTECT_HFS_DEFAULT
75 #define PROTECT_HFS_DEFAULT 0
76 #endif
77 int protect_hfs = PROTECT_HFS_DEFAULT;
78
79 #ifndef PROTECT_NTFS_DEFAULT
80 #define PROTECT_NTFS_DEFAULT 1
81 #endif
82 int protect_ntfs = PROTECT_NTFS_DEFAULT;
83
84 /*
85 * The character that begins a commented line in user-editable file
86 * that is subject to stripspace.
87 */
88 const char *comment_line_str = "#";
89 char *comment_line_str_to_free;
90 #ifndef WITH_BREAKING_CHANGES
91 int auto_comment_line_char;
92 bool warn_on_auto_comment_char;
93 #endif /* !WITH_BREAKING_CHANGES */
94
95 /* This is set by setup_git_directory_gently() and/or git_default_config() */
96 char *git_work_tree_cfg;
97
98 /*
99 * Repository-local GIT_* environment variables; see environment.h for details.
100 */
101 const char * const local_repo_env[] = {
102 ALTERNATE_DB_ENVIRONMENT,
103 CONFIG_ENVIRONMENT,
104 CONFIG_DATA_ENVIRONMENT,
105 CONFIG_COUNT_ENVIRONMENT,
106 DB_ENVIRONMENT,
107 GIT_DIR_ENVIRONMENT,
108 GIT_WORK_TREE_ENVIRONMENT,
109 GIT_IMPLICIT_WORK_TREE_ENVIRONMENT,
110 GRAFT_ENVIRONMENT,
111 INDEX_ENVIRONMENT,
112 NO_REPLACE_OBJECTS_ENVIRONMENT,
113 GIT_REPLACE_REF_BASE_ENVIRONMENT,
114 GIT_PREFIX_ENVIRONMENT,
115 GIT_SHALLOW_FILE_ENVIRONMENT,
116 GIT_COMMON_DIR_ENVIRONMENT,
117 NULL
118 };
119
120 const char *getenv_safe(struct strvec *argv, const char *name)
121 {
122 const char *value = getenv(name);
123
124 if (!value)
125 return NULL;
126
127 strvec_push(argv, value);
128 return argv->v[argv->nr - 1];
129 }
130
131 int is_bare_repository(void)
132 {
133 /* if core.bare is not 'false', let's see if there is a work tree */
134 return is_bare_repository_cfg && !repo_get_work_tree(the_repository);
135 }
136
137 int have_git_dir(void)
138 {
139 return startup_info->have_repository
140 || the_repository->gitdir;
141 }
142
143 const char *get_git_namespace(void)
144 {
145 static const char *namespace;
146 struct strbuf buf = STRBUF_INIT;
147 const char *raw_namespace;
148 struct string_list components = STRING_LIST_INIT_DUP;
149 struct string_list_item *item;
150
151 if (namespace)
152 return namespace;
153
154 raw_namespace = getenv(GIT_NAMESPACE_ENVIRONMENT);
155 if (!raw_namespace || !*raw_namespace) {
156 namespace = "";
157 return namespace;
158 }
159
160 strbuf_addstr(&buf, raw_namespace);
161
162 string_list_split(&components, buf.buf, "/", -1);
163 strbuf_reset(&buf);
164
165 for_each_string_list_item(item, &components) {
166 if (item->string[0])
167 strbuf_addf(&buf, "refs/namespaces/%s/", item->string);
168 }
169 string_list_clear(&components, 0);
170
171 strbuf_trim_trailing_dir_sep(&buf);
172 if (check_refname_format(buf.buf, 0))
173 die(_("bad git namespace path \"%s\""), raw_namespace);
174 strbuf_addch(&buf, '/');
175
176 namespace = strbuf_detach(&buf, NULL);
177
178 return namespace;
179 }
180
181 const char *strip_namespace(const char *namespaced_ref)
182 {
183 const char *out;
184 if (skip_prefix(namespaced_ref, get_git_namespace(), &out))
185 return out;
186 return NULL;
187 }
188
189 const char *get_log_output_encoding(void)
190 {
191 return git_log_output_encoding ? git_log_output_encoding
192 : get_commit_output_encoding();
193 }
194
195 const char *get_commit_output_encoding(void)
196 {
197 return git_commit_encoding ? git_commit_encoding : "UTF-8";
198 }
199
200 int use_optional_locks(void)
201 {
202 return git_env_bool(GIT_OPTIONAL_LOCKS_ENVIRONMENT, 1);
203 }
204
205 int print_sha1_ellipsis(void)
206 {
207 /*
208 * Determine if the calling environment contains the variable
209 * GIT_PRINT_SHA1_ELLIPSIS set to "yes".
210 */
211 static int cached_result = -1; /* unknown */
212
213 if (cached_result < 0) {
214 const char *v = getenv("GIT_PRINT_SHA1_ELLIPSIS");
215 cached_result = (v && !strcasecmp(v, "yes"));
216 }
217 return cached_result;
218 }
219
220 static const struct fsync_component_name {
221 const char *name;
222 enum fsync_component component_bits;
223 } fsync_component_names[] = {
224 { "loose-object", FSYNC_COMPONENT_LOOSE_OBJECT },
225 { "pack", FSYNC_COMPONENT_PACK },
226 { "pack-metadata", FSYNC_COMPONENT_PACK_METADATA },
227 { "commit-graph", FSYNC_COMPONENT_COMMIT_GRAPH },
228 { "index", FSYNC_COMPONENT_INDEX },
229 { "objects", FSYNC_COMPONENTS_OBJECTS },
230 { "reference", FSYNC_COMPONENT_REFERENCE },
231 { "derived-metadata", FSYNC_COMPONENTS_DERIVED_METADATA },
232 { "committed", FSYNC_COMPONENTS_COMMITTED },
233 { "added", FSYNC_COMPONENTS_ADDED },
234 { "all", FSYNC_COMPONENTS_ALL },
235 };
236
237 static enum fsync_component parse_fsync_components(const char *var, const char *string)
238 {
239 enum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT;
240 enum fsync_component positive = 0, negative = 0;
241
242 while (string) {
243 size_t len;
244 const char *ep;
245 int negated = 0;
246 int found = 0;
247
248 string = string + strspn(string, ", \t\n\r");
249 ep = strchrnul(string, ',');
250 len = ep - string;
251 if (!strcmp(string, "none")) {
252 current = FSYNC_COMPONENT_NONE;
253 goto next_name;
254 }
255
256 if (*string == '-') {
257 negated = 1;
258 string++;
259 len--;
260 if (!len)
261 warning(_("invalid value for variable %s"), var);
262 }
263
264 if (!len)
265 break;
266
267 for (size_t i = 0; i < ARRAY_SIZE(fsync_component_names); ++i) {
268 const struct fsync_component_name *n = &fsync_component_names[i];
269
270 if (strncmp(n->name, string, len))
271 continue;
272
273 found = 1;
274 if (negated)
275 negative |= n->component_bits;
276 else
277 positive |= n->component_bits;
278 }
279
280 if (!found) {
281 char *component = xstrndup(string, len);
282 warning(_("ignoring unknown core.fsync component '%s'"), component);
283 free(component);
284 }
285
286 next_name:
287 string = ep;
288 }
289
290 return (current & ~negative) | positive;
291 }
292
293 int git_default_core_config(const char *var, const char *value,
294 const struct config_context *ctx, void *cb)
295 {
296 struct repo_config_values *cfg = repo_config_values(the_repository);
297
298 /* This needs a better name */
299 if (!strcmp(var, "core.filemode")) {
300 trust_executable_bit = git_config_bool(var, value);
301 return 0;
302 }
303 if (!strcmp(var, "core.trustctime")) {
304 cfg->trust_ctime = git_config_bool(var, value);
305 return 0;
306 }
307 if (!strcmp(var, "core.checkstat")) {
308 if (!value)
309 return config_error_nonbool(var);
310 if (!strcasecmp(value, "default"))
311 cfg->check_stat = 1;
312 else if (!strcasecmp(value, "minimal"))
313 cfg->check_stat = 0;
314 else
315 return error(_("invalid value for '%s': '%s'"),
316 var, value);
317 }
318
319 if (!strcmp(var, "core.quotepath")) {
320 quote_path_fully = git_config_bool(var, value);
321 return 0;
322 }
323
324 if (!strcmp(var, "core.symlinks")) {
325 has_symlinks = git_config_bool(var, value);
326 return 0;
327 }
328
329 if (!strcmp(var, "core.ignorecase")) {
330 ignore_case = git_config_bool(var, value);
331 return 0;
332 }
333
334 if (!strcmp(var, "core.attributesfile")) {
335 FREE_AND_NULL(cfg->attributes_file);
336 return git_config_pathname(&cfg->attributes_file, var, value);
337 }
338
339 if (!strcmp(var, "core.bare")) {
340 is_bare_repository_cfg = git_config_bool(var, value);
341 return 0;
342 }
343
344 if (!strcmp(var, "core.ignorestat")) {
345 assume_unchanged = git_config_bool(var, value);
346 return 0;
347 }
348
349 if (!strcmp(var, "core.abbrev")) {
350 if (!value)
351 return config_error_nonbool(var);
352 if (!strcasecmp(value, "auto"))
353 default_abbrev = -1;
354 else if (!git_parse_maybe_bool_text(value))
355 default_abbrev = GIT_MAX_HEXSZ;
356 else {
357 int abbrev = git_config_int(var, value, ctx->kvi);
358 if (abbrev < minimum_abbrev)
359 return error(_("abbrev length out of range: %d"), abbrev);
360 default_abbrev = abbrev;
361 }
362 return 0;
363 }
364
365 if (!strcmp(var, "core.disambiguate"))
366 return set_disambiguate_hint_config(var, value);
367
368 if (!strcmp(var, "core.loosecompression")) {
369 int level = git_config_int(var, value, ctx->kvi);
370 if (level == -1)
371 level = Z_DEFAULT_COMPRESSION;
372 else if (level < 0 || level > Z_BEST_COMPRESSION)
373 die(_("bad zlib compression level %d"), level);
374 cfg->zlib_compression_level = level;
375 zlib_compression_seen = 1;
376 return 0;
377 }
378
379 if (!strcmp(var, "core.compression")) {
380 int level = git_config_int(var, value, ctx->kvi);
381 if (level == -1)
382 level = Z_DEFAULT_COMPRESSION;
383 else if (level < 0 || level > Z_BEST_COMPRESSION)
384 die(_("bad zlib compression level %d"), level);
385 if (!zlib_compression_seen)
386 cfg->zlib_compression_level = level;
387 if (!pack_compression_seen)
388 cfg->pack_compression_level = level;
389 return 0;
390 }
391
392 if (!strcmp(var, "core.autocrlf")) {
393 if (value && !strcasecmp(value, "input")) {
394 auto_crlf = AUTO_CRLF_INPUT;
395 return 0;
396 }
397 auto_crlf = git_config_bool(var, value);
398 return 0;
399 }
400
401 if (!strcmp(var, "core.safecrlf")) {
402 int eol_rndtrp_die;
403 if (value && !strcasecmp(value, "warn")) {
404 global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
405 return 0;
406 }
407 eol_rndtrp_die = git_config_bool(var, value);
408 global_conv_flags_eol = eol_rndtrp_die ?
409 CONV_EOL_RNDTRP_DIE : 0;
410 return 0;
411 }
412
413 if (!strcmp(var, "core.eol")) {
414 if (value && !strcasecmp(value, "lf"))
415 core_eol = EOL_LF;
416 else if (value && !strcasecmp(value, "crlf"))
417 core_eol = EOL_CRLF;
418 else if (value && !strcasecmp(value, "native"))
419 core_eol = EOL_NATIVE;
420 else
421 core_eol = EOL_UNSET;
422 return 0;
423 }
424
425 if (!strcmp(var, "core.checkroundtripencoding")) {
426 FREE_AND_NULL(check_roundtrip_encoding);
427 return git_config_string(&check_roundtrip_encoding, var, value);
428 }
429
430 if (!strcmp(var, "core.editor")) {
431 FREE_AND_NULL(editor_program);
432 return git_config_string(&editor_program, var, value);
433 }
434
435 if (!strcmp(var, "core.commentchar") ||
436 !strcmp(var, "core.commentstring")) {
437 if (!value) {
438 return config_error_nonbool(var);
439 #ifndef WITH_BREAKING_CHANGES
440 } else if (!strcasecmp(value, "auto")) {
441 auto_comment_line_char = 1;
442 FREE_AND_NULL(comment_line_str_to_free);
443 comment_line_str = "#";
444 #endif /* !WITH_BREAKING_CHANGES */
445 } else if (value[0]) {
446 if (strchr(value, '\n'))
447 return error(_("%s cannot contain newline"), var);
448 comment_line_str = value;
449 FREE_AND_NULL(comment_line_str_to_free);
450 #ifndef WITH_BREAKING_CHANGES
451 auto_comment_line_char = 0;
452 #endif /* !WITH_BREAKING_CHANGES */
453 } else
454 return error(_("%s must have at least one character"), var);
455 return 0;
456 }
457
458 if (!strcmp(var, "core.askpass")) {
459 FREE_AND_NULL(askpass_program);
460 return git_config_string(&askpass_program, var, value);
461 }
462
463 if (!strcmp(var, "core.excludesfile")) {
464 FREE_AND_NULL(excludes_file);
465 return git_config_pathname(&excludes_file, var, value);
466 }
467
468 if (!strcmp(var, "core.whitespace")) {
469 if (!value)
470 return config_error_nonbool(var);
471 whitespace_rule_cfg = parse_whitespace_rule(value);
472 return 0;
473 }
474
475 if (!strcmp(var, "core.fsync")) {
476 if (!value)
477 return config_error_nonbool(var);
478 fsync_components = parse_fsync_components(var, value);
479 return 0;
480 }
481
482 if (!strcmp(var, "core.fsyncmethod")) {
483 if (!value)
484 return config_error_nonbool(var);
485 if (!strcmp(value, "fsync"))
486 fsync_method = FSYNC_METHOD_FSYNC;
487 else if (!strcmp(value, "writeout-only"))
488 fsync_method = FSYNC_METHOD_WRITEOUT_ONLY;
489 else if (!strcmp(value, "batch"))
490 fsync_method = FSYNC_METHOD_BATCH;
491 else
492 warning(_("ignoring unknown core.fsyncMethod value '%s'"), value);
493
494 }
495
496 if (!strcmp(var, "core.fsyncobjectfiles")) {
497 if (fsync_object_files < 0)
498 warning(_("core.fsyncObjectFiles is deprecated; use core.fsync instead"));
499 fsync_object_files = git_config_bool(var, value);
500 return 0;
501 }
502
503 if (!strcmp(var, "core.lockfilepid")) {
504 lockfile_pid_enabled = git_config_bool(var, value);
505 return 0;
506 }
507
508 if (!strcmp(var, "core.createobject")) {
509 if (!value)
510 return config_error_nonbool(var);
511 if (!strcmp(value, "rename"))
512 object_creation_mode = OBJECT_CREATION_USES_RENAMES;
513 else if (!strcmp(value, "link"))
514 object_creation_mode = OBJECT_CREATION_USES_HARDLINKS;
515 else
516 die(_("invalid mode for object creation: %s"), value);
517 return 0;
518 }
519
520 if (!strcmp(var, "core.sparsecheckout")) {
521 cfg->apply_sparse_checkout = git_config_bool(var, value);
522 return 0;
523 }
524
525 if (!strcmp(var, "core.sparsecheckoutcone")) {
526 cfg->core_sparse_checkout_cone = git_config_bool(var, value);
527 return 0;
528 }
529
530 if (!strcmp(var, "core.precomposeunicode")) {
531 cfg->precomposed_unicode = git_config_bool(var, value);
532 return 0;
533 }
534
535 if (!strcmp(var, "core.protecthfs")) {
536 protect_hfs = git_config_bool(var, value);
537 return 0;
538 }
539
540 if (!strcmp(var, "core.protectntfs")) {
541 protect_ntfs = git_config_bool(var, value);
542 return 0;
543 }
544
545 /* Add other config variables here and to Documentation/config.adoc. */
546 return platform_core_config(var, value, ctx, cb);
547 }
548
549 static int git_default_sparse_config(const char *var, const char *value)
550 {
551 struct repo_config_values *cfg = repo_config_values(the_repository);
552
553 if (!strcmp(var, "sparse.expectfilesoutsideofpatterns")) {
554 cfg->sparse_expect_files_outside_of_patterns = git_config_bool(var, value);
555 return 0;
556 }
557
558 /* Add other config variables here and to Documentation/config/sparse.adoc. */
559 return 0;
560 }
561
562 static int git_default_i18n_config(const char *var, const char *value)
563 {
564 if (!strcmp(var, "i18n.commitencoding")) {
565 FREE_AND_NULL(git_commit_encoding);
566 return git_config_string(&git_commit_encoding, var, value);
567 }
568
569 if (!strcmp(var, "i18n.logoutputencoding")) {
570 FREE_AND_NULL(git_log_output_encoding);
571 return git_config_string(&git_log_output_encoding, var, value);
572 }
573
574 /* Add other config variables here and to Documentation/config.adoc. */
575 return 0;
576 }
577
578 static int git_default_branch_config(const char *var, const char *value)
579 {
580 struct repo_config_values *cfg = repo_config_values(the_repository);
581
582 if (!strcmp(var, "branch.autosetupmerge")) {
583 if (value && !strcmp(value, "always")) {
584 cfg->branch_track = BRANCH_TRACK_ALWAYS;
585 return 0;
586 } else if (value && !strcmp(value, "inherit")) {
587 cfg->branch_track = BRANCH_TRACK_INHERIT;
588 return 0;
589 } else if (value && !strcmp(value, "simple")) {
590 cfg->branch_track = BRANCH_TRACK_SIMPLE;
591 return 0;
592 }
593 cfg->branch_track = git_config_bool(var, value);
594 return 0;
595 }
596 if (!strcmp(var, "branch.autosetuprebase")) {
597 if (!value)
598 return config_error_nonbool(var);
599 else if (!strcmp(value, "never"))
600 autorebase = AUTOREBASE_NEVER;
601 else if (!strcmp(value, "local"))
602 autorebase = AUTOREBASE_LOCAL;
603 else if (!strcmp(value, "remote"))
604 autorebase = AUTOREBASE_REMOTE;
605 else if (!strcmp(value, "always"))
606 autorebase = AUTOREBASE_ALWAYS;
607 else
608 return error(_("malformed value for %s"), var);
609 return 0;
610 }
611
612 /* Add other config variables here and to Documentation/config.adoc. */
613 return 0;
614 }
615
616 static int git_default_push_config(const char *var, const char *value)
617 {
618 if (!strcmp(var, "push.default")) {
619 if (!value)
620 return config_error_nonbool(var);
621 else if (!strcmp(value, "nothing"))
622 push_default = PUSH_DEFAULT_NOTHING;
623 else if (!strcmp(value, "matching"))
624 push_default = PUSH_DEFAULT_MATCHING;
625 else if (!strcmp(value, "simple"))
626 push_default = PUSH_DEFAULT_SIMPLE;
627 else if (!strcmp(value, "upstream"))
628 push_default = PUSH_DEFAULT_UPSTREAM;
629 else if (!strcmp(value, "tracking")) /* deprecated */
630 push_default = PUSH_DEFAULT_UPSTREAM;
631 else if (!strcmp(value, "current"))
632 push_default = PUSH_DEFAULT_CURRENT;
633 else {
634 error(_("malformed value for %s: %s"), var, value);
635 return error(_("must be one of nothing, matching, simple, "
636 "upstream or current"));
637 }
638 return 0;
639 }
640
641 /* Add other config variables here and to Documentation/config.adoc. */
642 return 0;
643 }
644
645 static int git_default_attr_config(const char *var, const char *value)
646 {
647 if (!strcmp(var, "attr.tree")) {
648 FREE_AND_NULL(git_attr_tree);
649 return git_config_string(&git_attr_tree, var, value);
650 }
651
652 /*
653 * Add other attribute related config variables here and to
654 * Documentation/config/attr.adoc.
655 */
656 return 0;
657 }
658
659 int git_default_config(const char *var, const char *value,
660 const struct config_context *ctx, void *cb)
661 {
662 struct repo_config_values *cfg = repo_config_values(the_repository);
663
664 if (starts_with(var, "core."))
665 return git_default_core_config(var, value, ctx, cb);
666
667 if (starts_with(var, "user.") ||
668 starts_with(var, "author.") ||
669 starts_with(var, "committer."))
670 return git_ident_config(var, value, ctx, cb);
671
672 if (starts_with(var, "i18n."))
673 return git_default_i18n_config(var, value);
674
675 if (starts_with(var, "branch."))
676 return git_default_branch_config(var, value);
677
678 if (starts_with(var, "push."))
679 return git_default_push_config(var, value);
680
681 if (starts_with(var, "attr."))
682 return git_default_attr_config(var, value);
683
684 if (starts_with(var, "advice.") || starts_with(var, "color.advice"))
685 return git_default_advice_config(var, value);
686
687 if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) {
688 pager_use_color = git_config_bool(var,value);
689 return 0;
690 }
691
692 if (!strcmp(var, "pack.packsizelimit")) {
693 pack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);
694 return 0;
695 }
696
697 if (!strcmp(var, "pack.compression")) {
698 int level = git_config_int(var, value, ctx->kvi);
699 if (level == -1)
700 level = Z_DEFAULT_COMPRESSION;
701 else if (level < 0 || level > Z_BEST_COMPRESSION)
702 die(_("bad pack compression level %d"), level);
703 cfg->pack_compression_level = level;
704 pack_compression_seen = 1;
705 return 0;
706 }
707
708 if (starts_with(var, "sparse."))
709 return git_default_sparse_config(var, value);
710
711 /* Add other config variables here and to Documentation/config.adoc. */
712 return 0;
713 }
714
715 void repo_config_values_init(struct repo_config_values *cfg)
716 {
717 cfg->attributes_file = NULL;
718 cfg->apply_sparse_checkout = 0;
719 cfg->branch_track = BRANCH_TRACK_REMOTE;
720 cfg->trust_ctime = 1;
721 cfg->check_stat = 1;
722 cfg->zlib_compression_level = Z_BEST_SPEED;
723 cfg->pack_compression_level = Z_DEFAULT_COMPRESSION;
724 cfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
725 cfg->core_sparse_checkout_cone = 0;
726 cfg->sparse_expect_files_outside_of_patterns = 0;
727 cfg->warn_on_object_refname_ambiguity = 1;
728 }