]> git.proxmox.com Git - libgit2.git/commitdiff
repository: don't fail to create config option in inmemory repo
authorEdward Thomson <ethomson@edwardthomson.com>
Mon, 12 Jun 2017 11:02:27 +0000 (12:02 +0100)
committerEdward Thomson <ethomson@edwardthomson.com>
Mon, 12 Jun 2017 15:51:04 +0000 (16:51 +0100)
When in an in-memory repository - without a configuration file - do not
fail to create a configuration object.

src/repository.c

index 27553ad0aae46282e455a1ad7ffe916eb4351176..7ecb00ed8b51dcd4c4a5c5213a5d0c17f9a05c06 100644 (file)
@@ -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);