diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-09-16 18:36:23 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-09-16 18:36:23 +0100 |
commit | 080ae2e8e02a5fd7d708e50a5c6458ef2a8e3d05 (patch) | |
tree | 402a4c492faae8ea42e46eedbbc3ca057171bafc /src/dir.cpp | |
parent | Include . and .. in readdir results (diff) | |
download | netfs-gitfs-080ae2e8e02a5fd7d708e50a5c6458ef2a8e3d05.tar.bz2 netfs-gitfs-080ae2e8e02a5fd7d708e50a5c6458ef2a8e3d05.tar.xz netfs-gitfs-080ae2e8e02a5fd7d708e50a5c6458ef2a8e3d05.zip |
Single definition of constructing Attr from git things
Adds getattr helpers to handle logic for setting members from entry and
blob if available/appropriate, commit, gid, and uid.
Diffstat (limited to 'src/dir.cpp')
-rw-r--r-- | src/dir.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/dir.cpp b/src/dir.cpp index c608259..a825cc8 100644 --- a/src/dir.cpp +++ b/src/dir.cpp @@ -67,15 +67,7 @@ GitFS::Directory::listdir(const ::Ice::Current &) NetFS::DirectoryContents list; for (auto idx = git_tree_entrycount(subTree.get()); idx--;) { const auto entry = git_tree_entry_byindex(subTree.get(), idx); - NetFS::Attr attr {}; - attr << *entry << *repo->commit; - if (S_ISREG(git_tree_entry_filemode(entry))) { - auto blob = Git::blobLookup(repo->repo, *git_tree_entry_id(entry)); - attr << *blob; - } - attr.gid = repo->gid; - attr.uid = repo->uid; - list.emplace(git_tree_entry_name(entry), std::move(attr)); + list.emplace(git_tree_entry_name(entry), repo->getattr(entry)); } return list; } |