diff options
Diffstat (limited to 'src/git.cpp')
-rw-r--r-- | src/git.cpp | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/src/git.cpp b/src/git.cpp index f3f437e..1c9da62 100644 --- a/src/git.cpp +++ b/src/git.cpp @@ -1,13 +1,12 @@ #include "git.h" -#include <execinfo.h> #include <exceptions.h> -#include <types.h> +#include <execinfo.h> #include <sys/stat.h> +#include <types.h> namespace GitFS::Git { template<> - [[noreturn]] - void + [[noreturn]] void throwError<NetFS::SystemError>(int err) { if (err == GIT_ENOTFOUND) { @@ -17,63 +16,64 @@ namespace GitFS::Git { } template<> - [[noreturn]] - void + [[noreturn]] void throwError<NetFS::ConfigError>(int) { throw NetFS::ConfigError(); } - git_oid OidParse(const std::string_view & str) + git_oid + OidParse(const std::string_view & str) { git_oid oid; gitSafe<NetFS::ConfigError>(git_oid_fromstrn, &oid, str.data(), str.length()); return oid; } - RepositoryPtr RepositoryOpenBare(const std::string & path) + RepositoryPtr + RepositoryOpenBare(const std::string & path) { - return gitSafeGet<NetFS::ConfigError>( - git_repository_open_bare, git_repository_free, path.c_str()); + return gitSafeGet<NetFS::ConfigError>(git_repository_open_bare, git_repository_free, path.c_str()); } - BlobPtr BlobLookup(const RepositoryPtr & repo, const git_oid & blob) + BlobPtr + BlobLookup(const RepositoryPtr & repo, const git_oid & blob) { - return gitSafeGet<NetFS::SystemError>( - git_blob_lookup, git_blob_free, repo.get(), &blob); + return gitSafeGet<NetFS::SystemError>(git_blob_lookup, git_blob_free, repo.get(), &blob); } - CommitPtr CommitLookup(const RepositoryPtr & repo, const git_oid & commitId) + CommitPtr + CommitLookup(const RepositoryPtr & repo, const git_oid & commitId) { - return gitSafeGet<NetFS::ConfigError>( - git_commit_lookup, git_commit_free, repo.get(), &commitId); + return gitSafeGet<NetFS::ConfigError>(git_commit_lookup, git_commit_free, repo.get(), &commitId); } - TreePtr TreeLookup(const RepositoryPtr & repo, const git_oid & treeId) + TreePtr + TreeLookup(const RepositoryPtr & repo, const git_oid & treeId) { - return gitSafeGet<NetFS::SystemError>( - git_tree_lookup, git_tree_free, repo.get(), &treeId); + return gitSafeGet<NetFS::SystemError>(git_tree_lookup, git_tree_free, repo.get(), &treeId); } - TreeEntryPtr TreeEntryByPath(const TreePtr & tree, const std::string & path) + TreeEntryPtr + TreeEntryByPath(const TreePtr & tree, const std::string & path) { - return gitSafeGet<NetFS::SystemError>( - git_tree_entry_bypath, git_tree_entry_free, tree.get(), path.c_str() + 1); + return gitSafeGet<NetFS::SystemError>(git_tree_entry_bypath, git_tree_entry_free, tree.get(), path.c_str() + 1); } - RefPtr Commitish(const RepositoryPtr & repo, const std::string & name) + RefPtr + Commitish(const RepositoryPtr & repo, const std::string & name) { - return gitSafeGet<NetFS::ConfigError>( - git_reference_dwim, git_reference_free, repo.get(), name.c_str()); + return gitSafeGet<NetFS::ConfigError>(git_reference_dwim, git_reference_free, repo.get(), name.c_str()); } - RefPtr Resolve(const RefPtr & ref) + RefPtr + Resolve(const RefPtr & ref) { - return gitSafeGet<NetFS::ConfigError>( - git_reference_resolve, git_reference_free, ref.get()); + return gitSafeGet<NetFS::ConfigError>(git_reference_resolve, git_reference_free, ref.get()); } } namespace NetFS { - Attr & operator<<(Attr & a, const git_tree_entry & e) + Attr & + operator<<(Attr & a, const git_tree_entry & e) { a.mode = git_tree_entry_filemode(&e); if (S_ISDIR(a.mode)) { @@ -88,13 +88,15 @@ namespace NetFS { return a; } - Attr & operator<<(Attr & a, const git_commit & c) + Attr & + operator<<(Attr & a, const git_commit & c) { a.ctime = a.atime = a.mtime = git_commit_time(&c); return a; } - Attr & operator<<(Attr & a, const git_blob & b) + Attr & + operator<<(Attr & a, const git_blob & b) { a.blockSize = 1; a.blocks = a.size = git_blob_rawsize(&b); @@ -112,4 +114,3 @@ namespace std { return s; } } - |