summaryrefslogtreecommitdiff
path: root/src/git.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2020-08-22 15:26:11 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2020-08-22 15:26:11 +0100
commitf759884235b4594c4f960ea0c587697eef717665 (patch)
tree92f3b95e99fac6688a6d9cec88b6553cb77f0c60 /src/git.h
parentUpdate to new NetFS interface (diff)
downloadnetfs-gitfs-f759884235b4594c4f960ea0c587697eef717665.tar.bz2
netfs-gitfs-f759884235b4594c4f960ea0c587697eef717665.tar.xz
netfs-gitfs-f759884235b4594c4f960ea0c587697eef717665.zip
Clang-format
Diffstat (limited to 'src/git.h')
-rw-r--r--src/git.h40
1 files changed, 16 insertions, 24 deletions
diff --git a/src/git.h b/src/git.h
index 90eb4f9..96a79bd 100644
--- a/src/git.h
+++ b/src/git.h
@@ -1,38 +1,36 @@
#ifndef GITFS_GIT_H
#define GITFS_GIT_H
-#include <memory>
#include <git2.h>
+#include <memory>
#include <ostream>
namespace GitFS::Git {
- template<typename E>
- [[noreturn]] void throwError(int err);
+ template<typename E>[[noreturn]] void throwError(int err);
- template<typename E, typename ... P, typename ... A>
+ template<typename E, typename... P, typename... A>
void
- gitSafe(int (*func)(P...), A ... p)
+ gitSafe(int (*func)(P...), A... p)
{
if (int _giterror = func(p...)) {
throwError<E>(_giterror);
}
}
- template<typename T>
- using TPtr = std::shared_ptr<T>;
+ template<typename T> using TPtr = std::shared_ptr<T>;
- template<typename E, typename R, typename ... P, typename ... A>
+ template<typename E, typename R, typename... P, typename... A>
auto
- gitSafeGet(int(*get)(R**, P...), void(*release)(R*), A ... p)
+ gitSafeGet(int (*get)(R **, P...), void (*release)(R *), A... p)
{
R * r = nullptr;
gitSafe<E>(get, &r, p...);
return TPtr<R>(r, release);
}
- template<typename E, typename R, typename ... P, typename ... A>
+ template<typename E, typename R, typename... P, typename... A>
auto
- gitSafeGet(int(*get)(R**, P...), A ... p)
+ gitSafeGet(int (*get)(R **, P...), A... p)
{
R * r = nullptr;
gitSafe<E>(get, &r, p...);
@@ -41,28 +39,23 @@ namespace GitFS::Git {
git_oid OidParse(const std::string_view & str);
- using RepositoryPtr = decltype(gitSafeGet<std::exception>(
- git_repository_open_bare, git_repository_free, nullptr));
+ using RepositoryPtr = decltype(gitSafeGet<std::exception>(git_repository_open_bare, git_repository_free, nullptr));
RepositoryPtr RepositoryOpenBare(const std::string & path);
- using BlobPtr = decltype(gitSafeGet<std::exception>(
- git_blob_lookup, git_blob_free, nullptr, nullptr));
+ using BlobPtr = decltype(gitSafeGet<std::exception>(git_blob_lookup, git_blob_free, nullptr, nullptr));
BlobPtr BlobLookup(const RepositoryPtr & repo, const git_oid & blob);
- using CommitPtr = decltype(gitSafeGet<std::exception>(
- git_commit_lookup, git_commit_free, nullptr, nullptr));
+ using CommitPtr = decltype(gitSafeGet<std::exception>(git_commit_lookup, git_commit_free, nullptr, nullptr));
CommitPtr CommitLookup(const RepositoryPtr & repo, const git_oid & commitId);
- using TreePtr = decltype(gitSafeGet<std::exception>(
- git_tree_lookup, git_tree_free, nullptr, nullptr));
+ using TreePtr = decltype(gitSafeGet<std::exception>(git_tree_lookup, git_tree_free, nullptr, nullptr));
TreePtr TreeLookup(const RepositoryPtr & repo, const git_oid & treeId);
- using TreeEntryPtr = decltype(gitSafeGet<std::exception>(
- git_tree_entry_bypath, git_tree_entry_free, nullptr, nullptr));
+ using TreeEntryPtr
+ = decltype(gitSafeGet<std::exception>(git_tree_entry_bypath, git_tree_entry_free, nullptr, nullptr));
TreeEntryPtr TreeEntryByPath(const TreePtr & tree, const std::string & path);
- using RefPtr = decltype(gitSafeGet<std::exception>(
- git_reference_dwim, git_reference_free, nullptr, nullptr));
+ using RefPtr = decltype(gitSafeGet<std::exception>(git_reference_dwim, git_reference_free, nullptr, nullptr));
RefPtr Commitish(const RepositoryPtr & repo, const std::string & name);
RefPtr Resolve(const RefPtr &);
}
@@ -79,4 +72,3 @@ namespace std {
}
#endif
-