Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-11-04 01:02:07 +0300
committerEdward Thomson <ethomson@microsoft.com>2015-11-04 01:16:51 +0300
commitec50b23acc5a9f00f597fa877ad09cad56cb1204 (patch)
treed219f21a18d62dabd4e4487c1a2b3e313da6d30b /tests/core
parent2d556f31665e9fde0310f4ae89cd3f01a5810b1c (diff)
filebuf: detect directories in our way
When creating a filebuf, detect a directory that exists in our target file location. This prevents a failure later, when we try to move the lock file to the destination.
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/filebuf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/core/filebuf.c b/tests/core/filebuf.c
index 915e3cc34..93aaed759 100644
--- a/tests/core/filebuf.c
+++ b/tests/core/filebuf.c
@@ -230,3 +230,12 @@ void test_core_filebuf__hidden_file(void)
git_filebuf_cleanup(&file);
#endif
}
+
+void test_core_filebuf__detects_directory(void)
+{
+ git_filebuf file = GIT_FILEBUF_INIT, fail = GIT_FILEBUF_INIT;
+
+ cl_must_pass(p_mkdir("foo", 0777));
+ cl_git_fail_with(GIT_EDIRECTORY, git_filebuf_open(&file, "foo", 0, 0666));
+ cl_must_pass(p_rmdir("foo"));
+}