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:
authorRussell Belfer <rb@github.com>2014-08-09 00:17:50 +0400
committerRussell Belfer <rb@github.com>2014-08-09 00:17:50 +0400
commitf18234fad62b8f890ccd01bb15443afc2484af1b (patch)
treedc79accc50fc391fbbca3001df0538d19ffc01fa /tests/repo
parent8f759ac0b373eea9dcec680524a68a527d637937 (diff)
Don't report status on named pipes
Git skips entries in directories that are not S_ISDIR, S_ISREG, or S_ISLNK, so let's make libgit2 do the same thing.
Diffstat (limited to 'tests/repo')
-rw-r--r--tests/repo/iterator.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/repo/iterator.c b/tests/repo/iterator.c
index fb70a9ea0..764c2c6cd 100644
--- a/tests/repo/iterator.c
+++ b/tests/repo/iterator.c
@@ -960,3 +960,35 @@ void test_repo_iterator__fs_preserves_error(void)
git_iterator_free(i);
}
+
+void test_repo_iterator__skips_fifos_and_such(void)
+{
+#ifndef GIT_WIN32
+ git_iterator *i;
+ const git_index_entry *e;
+
+ g_repo = cl_git_sandbox_init("empty_standard_repo");
+
+ cl_must_pass(p_mkdir("empty_standard_repo/dir", 0777));
+ cl_git_mkfile("empty_standard_repo/file", "not me");
+
+ cl_assert(!mkfifo("empty_standard_repo/fifo", 0777));
+ cl_assert(!access("empty_standard_repo/fifo", F_OK));
+
+ cl_git_pass(git_iterator_for_filesystem(
+ &i, "empty_standard_repo", GIT_ITERATOR_INCLUDE_TREES |
+ GIT_ITERATOR_DONT_AUTOEXPAND, NULL, NULL));
+
+ cl_git_pass(git_iterator_advance(&e, i)); /* .git */
+ cl_assert(S_ISDIR(e->mode));
+ cl_git_pass(git_iterator_advance(&e, i)); /* dir */
+ cl_assert(S_ISDIR(e->mode));
+ /* skips fifo */
+ cl_git_pass(git_iterator_advance(&e, i)); /* file */
+ cl_assert(S_ISREG(e->mode));
+
+ cl_assert_equal_i(GIT_ITEROVER, git_iterator_advance(&e, i));
+
+ git_iterator_free(i);
+#endif
+}