diff options
-rw-r--r-- | src/dir.cpp | 4 | ||||
-rw-r--r-- | unittests/core.cpp | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/dir.cpp b/src/dir.cpp index b2de780..c608259 100644 --- a/src/dir.cpp +++ b/src/dir.cpp @@ -50,7 +50,9 @@ GitFS::Directory::readdir(const ::Ice::Current &) const auto subTree = getSubtree(); NetFS::NameList list; auto idx = git_tree_entrycount(subTree.get()); - list.reserve(idx); + list.reserve(idx + 2); + list.emplace_back("."); + list.emplace_back(".."); while (idx--) { const auto entry = git_tree_entry_byindex(subTree.get(), idx); list.emplace_back(git_tree_entry_name(entry)); diff --git a/unittests/core.cpp b/unittests/core.cpp index 960b491..f6a2341 100644 --- a/unittests/core.cpp +++ b/unittests/core.cpp @@ -257,11 +257,11 @@ BOOST_DATA_TEST_CASE(openDirNotDir, REGPATHS + LINKPATHS + EXECPATHS, path) } const auto DIRCONTENTS = btdata::make<std::vector<std::string>>({ - {".gitignore", "Jamroot.jam", "src", "unittests"}, - {"Jamfile.jam", "blob.cpp", "blob.h", "dir.cpp", "dir.h", "git.cpp", "git.h", "main.cpp", "repo.cpp", "repo.h", - "repoList.cpp", "repoList.h"}, - {"Jamfile.jam", "core.cpp", "fixtures", "mockDefs.cpp", "mockDefs.h"}, - {"executable", "symlink"}, + {".", "..", ".gitignore", "Jamroot.jam", "src", "unittests"}, + {".", "..", "Jamfile.jam", "blob.cpp", "blob.h", "dir.cpp", "dir.h", "git.cpp", "git.h", "main.cpp", "repo.cpp", + "repo.h", "repoList.cpp", "repoList.h"}, + {".", "..", "Jamfile.jam", "core.cpp", "fixtures", "mockDefs.cpp", "mockDefs.h"}, + {".", "..", "executable", "symlink"}, }); BOOST_DATA_TEST_CASE(openDirRead, DIRPATHS ^ DIRCONTENTS, path, contents) |