diff options
| author | Russell Belfer <rb@github.com> | 2012-12-19 14:52:12 -0800 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2013-01-04 15:23:47 -0800 |
| commit | e9e20c8474b4f7ecdb1076c2f2d9c06f21e6be5b (patch) | |
| tree | 33fbfba821ba0469e079da7c91f4075c2a0349b2 /tests-clar/clar_libgit2.c | |
| parent | 6040616214c69a53d2155c2378b31a0d65e37567 (diff) | |
| download | libgit2-e9e20c8474b4f7ecdb1076c2f2d9c06f21e6be5b.tar.gz | |
Update cl_git_pass to return more info
This adds a failure reporting function that is called by
cl_git_pass which captures the actual error return code and
the error message if available in the failure report.
Diffstat (limited to 'tests-clar/clar_libgit2.c')
| -rw-r--r-- | tests-clar/clar_libgit2.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests-clar/clar_libgit2.c b/tests-clar/clar_libgit2.c index ce3ec4af4..88ffb2bca 100644 --- a/tests-clar/clar_libgit2.c +++ b/tests-clar/clar_libgit2.c @@ -2,6 +2,16 @@ #include "posix.h" #include "path.h" +void cl_git_report_failure( + int error, const char *file, int line, const char *fncall) +{ + char msg[4096]; + const git_error *last = giterr_last(); + p_snprintf(msg, 4096, "error %d - %s", + error, last ? last->message : "<no message>"); + clar__assert(0, file, line, fncall, msg, 1); +} + void cl_git_mkfile(const char *filename, const char *content) { int fd; |
