return argv->v[argv->nr - 1];
}
-int is_bare_repository(void)
+int is_bare_repository(struct repository *repo)
{
/* if core.bare is not 'false', let's see if there is a work tree */
- return is_bare_repository_cfg && !repo_get_work_tree(the_repository);
+ return repo->bare_cfg && !repo_get_work_tree(repo);
}
+ int repo_protect_ntfs(struct repository *repo)
+ {
+ return (repo && repo->initialized) ?
+ repo_config_values(repo)->protect_ntfs :
+ PROTECT_NTFS_DEFAULT;
+ }
+
+ int repo_protect_hfs(struct repository *repo)
+ {
+ return (repo && repo->initialized) ?
+ repo_config_values(repo)->protect_hfs :
+ PROTECT_HFS_DEFAULT;
+ }
+
int have_git_dir(void)
{
return startup_info->have_repository
{
cfg->attributes_file = NULL;
cfg->apply_sparse_checkout = 0;
+ cfg->protect_hfs = PROTECT_HFS_DEFAULT;
+ cfg->protect_ntfs = PROTECT_NTFS_DEFAULT;
cfg->branch_track = BRANCH_TRACK_REMOTE;
+ cfg->trust_ctime = 1;
+ cfg->check_stat = 1;
+ cfg->zlib_compression_level = Z_BEST_SPEED;
+ cfg->pack_compression_level = Z_DEFAULT_COMPRESSION;
+ cfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
+ cfg->core_sparse_checkout_cone = 0;
+ cfg->sparse_expect_files_outside_of_patterns = 0;
+ cfg->warn_on_object_refname_ambiguity = 1;
}
/* section "core" config values */
char *attributes_file;
int apply_sparse_checkout;
+ int trust_ctime;
+ int check_stat;
+ int zlib_compression_level;
+ int pack_compression_level;
+ int precomposed_unicode;
+ int core_sparse_checkout_cone;
+ int warn_on_object_refname_ambiguity;
+ int protect_hfs;
+ int protect_ntfs;
+ /* section "sparse" config values */
+ int sparse_expect_files_outside_of_patterns;
+
/* section "branch" config values */
enum branch_track branch_track;
};
int git_default_core_config(const char *var, const char *value,
const struct config_context *ctx, void *cb);
+ /*
+ * Getters for the `protect_hfs` and `protect_ntfs` fields of `struct repo_config_values`.
+ * They check `repo->initialized` to prevent calling `repo_config_values()`
+ * before the repository setup is fully complete or in non-git environments.
+ */
+ int repo_protect_hfs(struct repository *repo);
+ int repo_protect_ntfs(struct repository *repo);
+
void repo_config_values_init(struct repo_config_values *cfg);
+int is_bare_repository(struct repository *repo);
+
/*
* TODO: All the below state either explicitly or implicitly relies on
* `the_repository`. We should eventually get rid of these and make the
extern int minimum_abbrev, default_abbrev;
extern int ignore_case;
extern int assume_unchanged;
-extern int warn_on_object_refname_ambiguity;
extern char *apply_default_whitespace;
extern char *apply_default_ignorewhitespace;
-extern int zlib_compression_level;
-extern int pack_compression_level;
extern unsigned long pack_size_limit_cfg;
- extern int protect_hfs;
- extern int protect_ntfs;
-extern int precomposed_unicode;
-
-extern int core_sparse_checkout_cone;
-extern int sparse_expect_files_outside_of_patterns;
--
enum rebase_setup_type {
AUTOREBASE_NEVER = 0,
AUTOREBASE_LOCAL,