From 801b1a160558ed8b862e683c7aaf5092b0c1adb2 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 28 Jul 2019 13:21:33 +0100 Subject: Support working tree based on a commit, tag or branch --- src/git.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/git.h') diff --git a/src/git.h b/src/git.h index 56a7cf6..068e8cf 100644 --- a/src/git.h +++ b/src/git.h @@ -14,7 +14,7 @@ namespace GitFS { void gitSafe(int (*func)(P...), A ... p) { - if (int _giterror = func(p...); _giterror != 0) { + if (int _giterror = func(p...)) { throwError(_giterror); } } @@ -61,6 +61,11 @@ namespace GitFS { 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 &); } } -- cgit v1.2.3