summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2020-05-23 11:42:19 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2020-05-23 16:24:36 +0100
commit392cb8cbb33bf4ddb468f3d5a9d42a281501d0f0 (patch)
tree15a66d43c8ebac74ad5f8f1d0aa717ec0305c4b1
parentd350e14e768f62720d28c80d15aa2bbe5069d1bf (diff)
downloadlibgit2-ethomson/config_unreadable.tar.gz
config: test that unreadable files are treated as notfoundethomson/config_unreadable
-rw-r--r--tests/config/read.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/config/read.c b/tests/config/read.c
index 008dfd9fc..ba97302f7 100644
--- a/tests/config/read.c
+++ b/tests/config/read.c
@@ -849,6 +849,23 @@ void test_config_read__invalid_quoted_third_section(void)
git_config_free(cfg);
}
+void test_config_read__unreadable_file_ignored(void)
+{
+ git_buf buf = GIT_BUF_INIT;
+ git_config *cfg;
+ int ret;
+
+ cl_set_cleanup(&clean_test_config, NULL);
+ cl_git_mkfile("./testconfig", "[some] var = value\n[some \"OtheR\"] var = value");
+ cl_git_pass(p_chmod("./testconfig", 0));
+
+ ret = git_config_open_ondisk(&cfg, "./test/config");
+ cl_assert(ret == 0 || ret == GIT_ENOTFOUND);
+
+ git_config_free(cfg);
+ git_buf_dispose(&buf);
+}
+
void test_config_read__single_line(void)
{
git_buf buf = GIT_BUF_INIT;