diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dir.cpp | 1 | ||||
-rw-r--r-- | src/repo.cpp | 12 | ||||
-rw-r--r-- | src/repo.h | 1 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/dir.cpp b/src/dir.cpp index a825cc8..9142cb7 100644 --- a/src/dir.cpp +++ b/src/dir.cpp @@ -65,6 +65,7 @@ GitFS::Directory::listdir(const ::Ice::Current &) { const auto subTree = getSubtree(); NetFS::DirectoryContents list; + list.emplace(".", list.emplace("..", repo->getdirattr()).first->second); for (auto idx = git_tree_entrycount(subTree.get()); idx--;) { const auto entry = git_tree_entry_byindex(subTree.get(), idx); list.emplace(git_tree_entry_name(entry), repo->getattr(entry)); diff --git a/src/repo.cpp b/src/repo.cpp index db21e61..5a889ea 100644 --- a/src/repo.cpp +++ b/src/repo.cpp @@ -122,9 +122,7 @@ GitFS::Repo::getattr(ReqEnv, const ::std::string path, const ::Ice::Current &) update(); if (path == "/") { - NetFS::Attr attr = getattr(nullptr, nullptr); - attr.mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; - return attr; + return getdirattr(); } return getattr(Git::treeEntryByPath(tree, path).get()); } @@ -154,6 +152,14 @@ GitFS::Repo::getattr(const git_tree_entry * entry, const git_blob * blob) const return attr; } +NetFS::Attr +GitFS::Repo::getdirattr() const +{ + NetFS::Attr attr = getattr(nullptr, nullptr); + attr.mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; + return attr; +} + ::std::string GitFS::Repo::readlink(ReqEnv, const ::std::string path, const ::Ice::Current &) { @@ -32,6 +32,7 @@ namespace GitFS { Attr getattr(ReqEnv env, ::std::string path, const ::Ice::Current & ice) override; [[nodiscard]] Attr getattr(const git_tree_entry *) const; [[nodiscard]] Attr getattr(const git_tree_entry *, const git_blob *) const; + [[nodiscard]] Attr getdirattr() const; ::std::string readlink(ReqEnv env, ::std::string path, const ::Ice::Current & ice) override; FilePrxPtr open(ReqEnv env, ::std::string path, int flags, const ::Ice::Current & ice) override; FilePrxPtr create(ReqEnv env, ::std::string path, int flags, int mode, const ::Ice::Current & ice) override; |