From 4c25da8a7ba7437657c3e2da592145113d3532f4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 20 Jul 2019 10:53:14 +0100 Subject: Initial commit Not a lot of stuff, hard coded paths, tests against /usr/portage --- src/git.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/git.cpp (limited to 'src/git.cpp') diff --git a/src/git.cpp b/src/git.cpp new file mode 100644 index 0000000..084e6ca --- /dev/null +++ b/src/git.cpp @@ -0,0 +1,30 @@ +#include "git.h" +#include +#include + +namespace GitFS { + namespace Git { + void + throwError(int err) + { +#if LIBGIT2_VER_MINOR >= 28 + const git_error * e = git_error_last(); +#else + const git_error * e = giterr_last(); +#endif + throw Error { err, e->klass, e->message }; + } + } +} + +namespace std { + std::ostream & + operator<<(std::ostream & s, const git_oid & oid) + { + char str[GIT_OID_HEXSZ + 1]; + git_oid_tostr(str, sizeof(str), &oid); + s.write(str, GIT_OID_HEXSZ); + return s; + } +} + -- cgit v1.2.3