diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2014-03-15 03:53:36 +0100 | 
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-04-18 16:03:01 +0200 | 
| commit | 29c4cb0965b67ad1ae7f640dfee67cf3ce358c26 (patch) | |
| tree | 6aaaea724b43049fdc045ae1ea6c043f44e34c0d /src/diff_driver.c | |
| parent | 55ebd7d369a789f27fe1ad6b8ec8965aa1335d08 (diff) | |
| download | libgit2-29c4cb0965b67ad1ae7f640dfee67cf3ce358c26.tar.gz | |
Use config snapshotting
This way we can assume we have a consistent view of the config situation
when we're looking up remote, branch, pack-objects, etc.
Diffstat (limited to 'src/diff_driver.c')
| -rw-r--r-- | src/diff_driver.c | 8 | 
1 files changed, 6 insertions, 2 deletions
| diff --git a/src/diff_driver.c b/src/diff_driver.c index 8136e0dd9..6e87fd6f8 100644 --- a/src/diff_driver.c +++ b/src/diff_driver.c @@ -219,7 +219,7 @@ static int git_diff_driver_load(  	git_diff_driver *drv = NULL;  	size_t namelen = strlen(driver_name);  	khiter_t pos; -	git_config *cfg; +	git_config *cfg, *repo_cfg;  	git_buf name = GIT_BUF_INIT;  	const git_config_entry *ce;  	bool found_driver = false; @@ -234,11 +234,14 @@ static int git_diff_driver_load(  	}  	/* if you can't read config for repo, just use default driver */ -	if (git_repository_config__weakptr(&cfg, repo) < 0) { +	if (git_repository_config__weakptr(&repo_cfg, repo) < 0) {  		giterr_clear();  		goto done;  	} +	if ((error = git_config_snapshot(&cfg, repo_cfg)) < 0) +		return error; +  	drv = git__calloc(1, sizeof(git_diff_driver) + namelen + 1);  	GITERR_CHECK_ALLOC(drv);  	drv->type = DIFF_DRIVER_AUTO; @@ -321,6 +324,7 @@ static int git_diff_driver_load(  done:  	git_buf_free(&name); +	git_config_free(cfg);  	if (!*out) {  		int error2 = git_diff_driver_builtin(out, reg, driver_name); | 
