diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2017-06-12 12:02:27 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2017-06-12 16:51:04 +0100 |
commit | 2d486781df0828eae716937b23d2df0a9c1817f9 (patch) | |
tree | 469e0f9623e35de59b2dac208c924fe34802ce60 | |
parent | 9d49a43c718d0749231ac54adf4b72775cc40354 (diff) | |
download | libgit2-2d486781df0828eae716937b23d2df0a9c1817f9.tar.gz |
repository: don't fail to create config option in inmemory repo
When in an in-memory repository - without a configuration file - do not
fail to create a configuration object.
-rw-r--r-- | src/repository.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/repository.c b/src/repository.c index 27553ad0a..7ecb00ed8 100644 --- a/src/repository.c +++ b/src/repository.c @@ -943,13 +943,10 @@ static int load_config( if ((error = git_config_new(&cfg)) < 0) return error; - error = git_repository_item_path(&config_path, repo, GIT_REPOSITORY_ITEM_CONFIG); - if (error < 0) - goto on_error; + if ((error = git_repository_item_path(&config_path, repo, GIT_REPOSITORY_ITEM_CONFIG)) == 0) + error = git_config_add_file_ondisk(cfg, config_path.ptr, GIT_CONFIG_LEVEL_LOCAL, 0); - if ((error = git_config_add_file_ondisk( - cfg, config_path.ptr, GIT_CONFIG_LEVEL_LOCAL, 0)) < 0 && - error != GIT_ENOTFOUND) + if (error && error != GIT_ENOTFOUND) goto on_error; git_buf_free(&config_path); |