diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-07-20 10:53:14 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-07-20 10:53:14 +0100 |
commit | 4c25da8a7ba7437657c3e2da592145113d3532f4 (patch) | |
tree | 40f0468135089ff4f9e967bf8ee74b020bee67f7 /src/git.cpp | |
download | netfs-gitfs-4c25da8a7ba7437657c3e2da592145113d3532f4.tar.bz2 netfs-gitfs-4c25da8a7ba7437657c3e2da592145113d3532f4.tar.xz netfs-gitfs-4c25da8a7ba7437657c3e2da592145113d3532f4.zip |
Initial commit
Not a lot of stuff, hard coded paths, tests against /usr/portage
Diffstat (limited to 'src/git.cpp')
-rw-r--r-- | src/git.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
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 <execinfo.h> +#include <exceptions.h> + +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; + } +} + |