From db00a9699e3b12e5f1b79b55a4fd35c4e1dee163 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 22 Jul 2019 22:14:31 +0100 Subject: Replace hard-coded test values with properties --- src/repo.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/repo.cpp') diff --git a/src/repo.cpp b/src/repo.cpp index 32fa401..4059897 100644 --- a/src/repo.cpp +++ b/src/repo.cpp @@ -4,13 +4,17 @@ #include "blob.h" #include "dir.h" -// Testing -#include +std::string operator/(const std::string & a, const std::string & b) +{ + return a.empty() ? b : a; +} -GitFS::Repo::Repo() : - repo(Git::RepositoryOpenBare(rootDir)), - commit(Git::CommitLookup(repo, Git::OidParse("7a0ccb40084c3ab31d9856e7f689c0514c28c930"))), - tree(Git::TreeLookup(repo, *git_commit_tree_id(commit.get()))) +GitFS::Repo::Repo(const PropertyReader & properties) : + repo(Git::RepositoryOpenBare(properties("gitdir"))), + commit(Git::CommitLookup(repo, Git::OidParse(properties("commit")))), + tree(Git::TreeLookup(repo, *git_commit_tree_id(commit.get()))), + gid(properties("gid") / "root"), + uid(properties("uid") / "root") { } @@ -82,7 +86,8 @@ GitFS::Repo::getattr(ReqEnv, ::std::string path, const ::Ice::Current&) } } a << *commit; - a.gid = a.uid = "root"; + a.gid = gid; + a.uid = uid; return a; } -- cgit v1.2.3