summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/service/utils/git.cpp2
-rw-r--r--gentoobrowse-api/service/utils/git.h10
2 files changed, 8 insertions, 4 deletions
diff --git a/gentoobrowse-api/service/utils/git.cpp b/gentoobrowse-api/service/utils/git.cpp
index 71856d8..9a1cae2 100644
--- a/gentoobrowse-api/service/utils/git.cpp
+++ b/gentoobrowse-api/service/utils/git.cpp
@@ -31,7 +31,7 @@ namespace Gentoo {
}
AdHocFormatter(RefSpec, "refs/heads/%?:refs/remotes/%?/%?");
- std::unique_ptr<git_annotated_commit, void (*)(git_annotated_commit*)>
+ GitAnnotatedCommitPtr
gitFetch(git_repository * repo, git_remote * remote, const char * remoteBranchName)
{
auto opts = gitSafeGet(git_fetch_init_options, GIT_FETCH_OPTIONS_VERSION);
diff --git a/gentoobrowse-api/service/utils/git.h b/gentoobrowse-api/service/utils/git.h
index 59f06f0..20e8755 100644
--- a/gentoobrowse-api/service/utils/git.h
+++ b/gentoobrowse-api/service/utils/git.h
@@ -19,13 +19,16 @@ namespace Gentoo {
}
}
+ template<typename T>
+ using GitTPtr = std::unique_ptr<T, void(*)(T*)>;
+
template<typename R, typename ... P, typename ... A>
- std::unique_ptr<R, void(*)(R*)>
+ GitTPtr<R>
gitSafeGet(int(*get)(R**, P...), void(*release)(R*), A ... p)
{
R * r = nullptr;
gitSafe(get, &r, p...);
- return std::unique_ptr<R, void(*)(R*)>(r, release);
+ return GitTPtr<R>(r, release);
}
template<typename R, typename ... P, typename ... A>
@@ -39,7 +42,8 @@ namespace Gentoo {
std::string operator*(const git_oid &);
- std::unique_ptr<git_annotated_commit, void (*)(git_annotated_commit*)>
+ using GitAnnotatedCommitPtr = GitTPtr<git_annotated_commit>;
+ GitAnnotatedCommitPtr
gitFetch(git_repository * repo, git_remote * remote, const char * branch);
git_oid