summaryrefslogtreecommitdiff
path: root/src/repo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/repo.cpp')
-rw-r--r--src/repo.cpp86
1 files changed, 31 insertions, 55 deletions
diff --git a/src/repo.cpp b/src/repo.cpp
index 9bf156a..41e6f7d 100644
--- a/src/repo.cpp
+++ b/src/repo.cpp
@@ -1,21 +1,18 @@
-#include <Ice/ObjectAdapter.h>
-#include <sys/stat.h>
#include "repo.h"
#include "blob.h"
#include "dir.h"
+#include <Ice/ObjectAdapter.h>
+#include <sys/stat.h>
-std::string operator/(const std::string & a, const std::string & b)
+std::string
+operator/(const std::string & a, const std::string & b)
{
return a.empty() ? b : a;
}
GitFS::Repo::Repo(const PropertyReader & properties) :
- repo(Git::RepositoryOpenBare(properties("gitdir"))),
- commitish(properties("commitish") / "master"),
- isBranch(false),
- resolvedAt(0),
- gid(properties("gid") / "root"),
- uid(properties("uid") / "root")
+ repo(Git::RepositoryOpenBare(properties("gitdir"))), commitish(properties("commitish") / "master"), isBranch(false),
+ resolvedAt(0), gid(properties("gid") / "root"), uid(properties("uid") / "root")
{
if (commitish.length() == GIT_OID_HEXSZ) {
commit = Git::CommitLookup(repo, Git::OidParse(commitish));
@@ -31,34 +28,31 @@ void
GitFS::Repo::update()
{
if (!commit || (isBranch && ref && resolvedAt < std::time(nullptr) - 30)) {
- commit = Git::CommitLookup(repo,
- *git_reference_target(Git::Resolve(ref).get()));
+ commit = Git::CommitLookup(repo, *git_reference_target(Git::Resolve(ref).get()));
resolvedAt = std::time(nullptr);
}
tree = Git::TreeLookup(repo, *git_commit_tree_id(commit.get()));
}
void
-GitFS::Repo::disconnect(const ::Ice::Current& current)
+GitFS::Repo::disconnect(const ::Ice::Current & current)
{
current.adapter->remove(current.id);
}
-
NetFS::DirectoryPrxPtr
-GitFS::Repo::opendir(ReqEnv, ::std::string path, const ::Ice::Current& ice)
+GitFS::Repo::opendir(ReqEnv, ::std::string path, const ::Ice::Current & ice)
{
if (path.empty()) {
throw NetFS::SystemError(EINVAL);
}
- return Ice::uncheckedCast<NetFS::DirectoryPrx>(ice.adapter->addWithUUID(
- std::make_shared<Directory>(this, std::move(path))));
+ return Ice::uncheckedCast<NetFS::DirectoryPrx>(
+ ice.adapter->addWithUUID(std::make_shared<Directory>(this, std::move(path))));
}
-
NetFS::VFS
-GitFS::Repo::statfs(ReqEnv, ::std::string path, const ::Ice::Current&)
+GitFS::Repo::statfs(ReqEnv, ::std::string path, const ::Ice::Current &)
{
if (path.empty()) {
throw NetFS::SystemError(EINVAL);
@@ -67,9 +61,8 @@ GitFS::Repo::statfs(ReqEnv, ::std::string path, const ::Ice::Current&)
return {};
}
-
int
-GitFS::Repo::access(ReqEnv, ::std::string path, int mode, const ::Ice::Current&)
+GitFS::Repo::access(ReqEnv, ::std::string path, int mode, const ::Ice::Current &)
{
if (mode & W_OK) {
return EACCES;
@@ -106,9 +99,8 @@ GitFS::Repo::access(ReqEnv, ::std::string path, int mode, const ::Ice::Current&)
}
}
-
NetFS::Attr
-GitFS::Repo::getattr(ReqEnv, ::std::string path, const ::Ice::Current&)
+GitFS::Repo::getattr(ReqEnv, ::std::string path, const ::Ice::Current &)
{
if (path.empty()) {
throw NetFS::SystemError(EINVAL);
@@ -133,9 +125,8 @@ GitFS::Repo::getattr(ReqEnv, ::std::string path, const ::Ice::Current&)
return a;
}
-
::std::string
-GitFS::Repo::readlink(ReqEnv, ::std::string path, const ::Ice::Current&)
+GitFS::Repo::readlink(ReqEnv, ::std::string path, const ::Ice::Current &)
{
if (path.empty() || path == "/") {
throw NetFS::SystemError(EINVAL);
@@ -148,12 +139,11 @@ GitFS::Repo::readlink(ReqEnv, ::std::string path, const ::Ice::Current&)
}
auto blob = Git::BlobLookup(repo, *git_tree_entry_id(e.get()));
auto n = static_cast<const ::std::string::value_type *>(git_blob_rawcontent(blob.get()));
- return { n, n + git_blob_rawsize(blob.get()) };
+ return {n, n + git_blob_rawsize(blob.get())};
}
-
NetFS::FilePrxPtr
-GitFS::Repo::open(ReqEnv, ::std::string path, int, const ::Ice::Current& ice)
+GitFS::Repo::open(ReqEnv, ::std::string path, int, const ::Ice::Current & ice)
{
if (path.empty()) {
throw NetFS::SystemError(EINVAL);
@@ -163,92 +153,78 @@ GitFS::Repo::open(ReqEnv, ::std::string path, int, const ::Ice::Current& ice)
}
update();
- return Ice::uncheckedCast<NetFS::FilePrx>(ice.adapter->addWithUUID(
- std::make_shared<Blob>(this, std::move(path))));
+ return Ice::uncheckedCast<NetFS::FilePrx>(ice.adapter->addWithUUID(std::make_shared<Blob>(this, std::move(path))));
}
-
NetFS::FilePrxPtr
-GitFS::Repo::create(ReqEnv, ::std::string, int, int, const ::Ice::Current&)
+GitFS::Repo::create(ReqEnv, ::std::string, int, int, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
void
-GitFS::Repo::truncate(ReqEnv, ::std::string, long long int, const ::Ice::Current&)
+GitFS::Repo::truncate(ReqEnv, ::std::string, long long int, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
void
-GitFS::Repo::unlink(ReqEnv, ::std::string, const ::Ice::Current&)
+GitFS::Repo::unlink(ReqEnv, ::std::string, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
void
-GitFS::Repo::mkdir(ReqEnv, ::std::string, int, const ::Ice::Current&)
+GitFS::Repo::mkdir(ReqEnv, ::std::string, int, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
void
-GitFS::Repo::rmdir(ReqEnv, ::std::string, const ::Ice::Current&)
+GitFS::Repo::rmdir(ReqEnv, ::std::string, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
void
-GitFS::Repo::mknod(ReqEnv, ::std::string, int, int, const ::Ice::Current&)
+GitFS::Repo::mknod(ReqEnv, ::std::string, int, int, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
void
-GitFS::Repo::symlink(ReqEnv, ::std::string, ::std::string, const ::Ice::Current&)
+GitFS::Repo::symlink(ReqEnv, ::std::string, ::std::string, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
void
-GitFS::Repo::link(ReqEnv, ::std::string, ::std::string, const ::Ice::Current&)
+GitFS::Repo::link(ReqEnv, ::std::string, ::std::string, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
void
-GitFS::Repo::rename(ReqEnv, ::std::string, ::std::string, const Ice::optional<Ice::Int>, const ::Ice::Current&)
+GitFS::Repo::rename(ReqEnv, ::std::string, ::std::string, const Ice::optional<Ice::Int>, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
void
-GitFS::Repo::chmod(ReqEnv, ::std::string, int, const ::Ice::Current&)
+GitFS::Repo::chmod(ReqEnv, ::std::string, int, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
void
-GitFS::Repo::chown(ReqEnv, ::std::string, int, int, const ::Ice::Current&)
+GitFS::Repo::chown(ReqEnv, ::std::string, int, int, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
void
-GitFS::Repo::utimens(ReqEnv, ::std::string, long long int, long long int, long long int, long long int, const ::Ice::Current&)
+GitFS::Repo::utimens(
+ ReqEnv, ::std::string, long long int, long long int, long long int, long long int, const ::Ice::Current &)
{
throw NetFS::SystemError(EROFS);
}
-
-