summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--misc/diag.c18
-rw-r--r--misc/diag.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/misc/diag.c b/misc/diag.c
index 5294129..7ab7908 100644
--- a/misc/diag.c
+++ b/misc/diag.c
@@ -17,6 +17,7 @@
#include <string.h>
#include <errno.h>
+#include <git2.h>
#include "misc/diag.h"
@@ -39,8 +40,25 @@ void diag_perror(const char *s)
}
+void pfatal_git(const char *s)
+{
+ const git_error *e = giterr_last();
+
+ fatal("%s: %s", s, e->message);
+}
+
+
+void perror_git(const char *s)
+{
+ const git_error *e = giterr_last();
+
+ error("%s: %s", s, e->message);
+}
+
+
/* ----- General diagnostic functions -------------------------------------- */
+
void fatal(const char *fmt, ...)
{
va_list ap;
diff --git a/misc/diag.h b/misc/diag.h
index 5e2df87..8adddbb 100644
--- a/misc/diag.h
+++ b/misc/diag.h
@@ -41,6 +41,8 @@ extern unsigned verbose;
void __attribute__((noreturn)) diag_pfatal(const char *s);
void diag_perror(const char *s);
+void __attribute__((noreturn)) pfatal_git(const char *s);
+void perror_git(const char *s);
/* ----- General diagnostic functions -------------------------------------- */