summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/config.c b/config.c
index f33abea..2edf835 100644
--- a/config.c
+++ b/config.c
@@ -76,7 +76,6 @@ static struct key_value_info *current_config_kvi;
*/
static enum config_scope current_parsing_scope;
-static int core_compression_seen;
static int pack_compression_seen;
static int zlib_compression_seen;
@@ -137,7 +136,7 @@ static int handle_path_include(const char *path, struct config_include_data *inc
if (!path)
return config_error_nonbool("include.path");
- expanded = expand_user_path(path, 0);
+ expanded = interpolate_path(path, 0);
if (!expanded)
return error(_("could not expand include path '%s'"), path);
path = expanded;
@@ -185,7 +184,7 @@ static int prepare_include_condition_pattern(struct strbuf *pat)
char *expanded;
int prefix = 0;
- expanded = expand_user_path(pat->buf, 1);
+ expanded = interpolate_path(pat->buf, 1);
if (expanded) {
strbuf_reset(pat);
strbuf_addstr(pat, expanded);
@@ -1270,7 +1269,7 @@ int git_config_pathname(const char **dest, const char *var, const char *value)
{
if (!value)
return config_error_nonbool(var);
- *dest = expand_user_path(value, 0);
+ *dest = interpolate_path(value, 0);
if (!*dest)
die(_("failed to expand user dir in: '%s'"), value);
return 0;
@@ -1400,8 +1399,6 @@ static int git_default_core_config(const char *var, const char *value, void *cb)
level = Z_DEFAULT_COMPRESSION;
else if (level < 0 || level > Z_BEST_COMPRESSION)
die(_("bad zlib compression level %d"), level);
- core_compression_level = level;
- core_compression_seen = 1;
if (!zlib_compression_seen)
zlib_compression_level = level;
if (!pack_compression_seen)
@@ -1796,6 +1793,7 @@ int git_config_from_mem(config_fn_t fn,
int git_config_from_blob_oid(config_fn_t fn,
const char *name,
+ struct repository *repo,
const struct object_id *oid,
void *data)
{
@@ -1804,7 +1802,7 @@ int git_config_from_blob_oid(config_fn_t fn,
unsigned long size;
int ret;
- buf = read_object_file(oid, &type, &size);
+ buf = repo_read_object_file(repo, oid, &type, &size);
if (!buf)
return error(_("unable to load config blob object '%s'"), name);
if (type != OBJ_BLOB) {
@@ -1820,14 +1818,15 @@ int git_config_from_blob_oid(config_fn_t fn,
}
static int git_config_from_blob_ref(config_fn_t fn,
+ struct repository *repo,
const char *name,
void *data)
{
struct object_id oid;
- if (get_oid(name, &oid) < 0)
+ if (repo_get_oid(repo, name, &oid) < 0)
return error(_("unable to resolve config blob '%s'"), name);
- return git_config_from_blob_oid(fn, name, &oid, data);
+ return git_config_from_blob_oid(fn, name, repo, &oid, data);
}
char *git_system_config(void)
@@ -1845,7 +1844,7 @@ void git_global_config(char **user_out, char **xdg_out)
char *xdg_config = NULL;
if (!user_config) {
- user_config = expand_user_path("~/.gitconfig", 0);
+ user_config = interpolate_path("~/.gitconfig", 0);
xdg_config = xdg_config_home("config");
}
@@ -1958,12 +1957,16 @@ int config_with_options(config_fn_t fn, void *data,
* If we have a specific filename, use it. Otherwise, follow the
* regular lookup sequence.
*/
- if (config_source && config_source->use_stdin)
+ if (config_source && config_source->use_stdin) {
return git_config_from_stdin(fn, data);
- else if (config_source && config_source->file)
+ } else if (config_source && config_source->file) {
return git_config_from_file(fn, config_source->file, data);
- else if (config_source && config_source->blob)
- return git_config_from_blob_ref(fn, config_source->blob, data);
+ } else if (config_source && config_source->blob) {
+ struct repository *repo = config_source->repo ?
+ config_source->repo : the_repository;
+ return git_config_from_blob_ref(fn, repo, config_source->blob,
+ data);
+ }
return do_git_config_sequence(opts, fn, data);
}