From 97b1aae251a48af7b85eafd76e5284458d42f181 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 27 Oct 2019 12:01:06 +0000 Subject: Fixes for tidy --- src/git.h | 100 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 49 insertions(+), 51 deletions(-) (limited to 'src/git.h') diff --git a/src/git.h b/src/git.h index 068e8cf..90eb4f9 100644 --- a/src/git.h +++ b/src/git.h @@ -5,68 +5,66 @@ #include #include -namespace GitFS { - namespace Git { - template - [[noreturn]] void throwError(int err); - - template - void - gitSafe(int (*func)(P...), A ... p) - { - if (int _giterror = func(p...)) { - throwError(_giterror); - } +namespace GitFS::Git { + template + [[noreturn]] void throwError(int err); + + template + void + gitSafe(int (*func)(P...), A ... p) + { + if (int _giterror = func(p...)) { + throwError(_giterror); } + } - template - using TPtr = std::shared_ptr; + template + using TPtr = std::shared_ptr; - template - auto - gitSafeGet(int(*get)(R**, P...), void(*release)(R*), A ... p) - { - R * r = nullptr; - gitSafe(get, &r, p...); - return TPtr(r, release); - } + template + auto + gitSafeGet(int(*get)(R**, P...), void(*release)(R*), A ... p) + { + R * r = nullptr; + gitSafe(get, &r, p...); + return TPtr(r, release); + } - template - auto - gitSafeGet(int(*get)(R**, P...), A ... p) - { - R * r = nullptr; - gitSafe(get, &r, p...); - return r; - } + template + auto + gitSafeGet(int(*get)(R**, P...), A ... p) + { + R * r = nullptr; + gitSafe(get, &r, p...); + return r; + } - git_oid OidParse(const std::string_view & str); + git_oid OidParse(const std::string_view & str); - using RepositoryPtr = decltype(gitSafeGet( - git_repository_open_bare, git_repository_free, nullptr)); - RepositoryPtr RepositoryOpenBare(const std::string & path); + using RepositoryPtr = decltype(gitSafeGet( + git_repository_open_bare, git_repository_free, nullptr)); + RepositoryPtr RepositoryOpenBare(const std::string & path); - using BlobPtr = decltype(gitSafeGet( - git_blob_lookup, git_blob_free, nullptr, nullptr)); - BlobPtr BlobLookup(const RepositoryPtr & repo, const git_oid & blob); + using BlobPtr = decltype(gitSafeGet( + git_blob_lookup, git_blob_free, nullptr, nullptr)); + BlobPtr BlobLookup(const RepositoryPtr & repo, const git_oid & blob); - using CommitPtr = decltype(gitSafeGet( - git_commit_lookup, git_commit_free, nullptr, nullptr)); - CommitPtr CommitLookup(const RepositoryPtr & repo, const git_oid & commitId); + using CommitPtr = decltype(gitSafeGet( + git_commit_lookup, git_commit_free, nullptr, nullptr)); + CommitPtr CommitLookup(const RepositoryPtr & repo, const git_oid & commitId); - using TreePtr = decltype(gitSafeGet( - git_tree_lookup, git_tree_free, nullptr, nullptr)); - TreePtr TreeLookup(const RepositoryPtr & repo, const git_oid & treeId); + using TreePtr = decltype(gitSafeGet( + git_tree_lookup, git_tree_free, nullptr, nullptr)); + TreePtr TreeLookup(const RepositoryPtr & repo, const git_oid & treeId); - using TreeEntryPtr = decltype(gitSafeGet( - git_tree_entry_bypath, git_tree_entry_free, nullptr, nullptr)); - TreeEntryPtr TreeEntryByPath(const TreePtr & tree, const std::string & path); + using TreeEntryPtr = decltype(gitSafeGet( + git_tree_entry_bypath, git_tree_entry_free, nullptr, nullptr)); + TreeEntryPtr TreeEntryByPath(const TreePtr & tree, const std::string & path); - using RefPtr = decltype(gitSafeGet( - git_reference_dwim, git_reference_free, nullptr, nullptr)); - RefPtr Commitish(const RepositoryPtr & repo, const std::string & name); - RefPtr Resolve(const RefPtr &); - } + using RefPtr = decltype(gitSafeGet( + git_reference_dwim, git_reference_free, nullptr, nullptr)); + RefPtr Commitish(const RepositoryPtr & repo, const std::string & name); + RefPtr Resolve(const RefPtr &); } namespace NetFS { -- cgit v1.2.3