Merge branch 'sb/submodule-merge-in-merge-recursive'
[gitweb.git] / usage.c
diff --git a/usage.c b/usage.c
index cdd534c9dfc4bd38ce112da62643ab2dc7b4fbe9..9c84dccfa9719d925b23eb63247d79d5dfe4b817 100644 (file)
--- a/usage.c
+++ b/usage.c
@@ -210,6 +210,9 @@ void warning(const char *warn, ...)
        va_end(params);
 }
 
+/* Only set this, ever, from t/helper/, when verifying that bugs are caught. */
+int BUG_exit_code;
+
 static NORETURN void BUG_vfl(const char *file, int line, const char *fmt, va_list params)
 {
        char prefix[256];
@@ -221,6 +224,8 @@ static NORETURN void BUG_vfl(const char *file, int line, const char *fmt, va_lis
                snprintf(prefix, sizeof(prefix), "BUG: ");
 
        vreportf(prefix, fmt, params);
+       if (BUG_exit_code)
+               exit(BUG_exit_code);
        abort();
 }