diff options
author | Russell Belfer <rb@github.com> | 2014-03-11 16:41:11 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-03-11 16:41:11 -0700 |
commit | 680f306d361609a818e8d9ebb382286be084263c (patch) | |
tree | 35095a63ca4686f8213e9793b5071ff1dd928bb6 /include/git2/sys/warning.h | |
parent | 676a34a33d9ef18163c3a33bac60083de471144f (diff) | |
download | libgit2-rb/warnings-for-commit-headers.tar.gz |
Warnings that default to being errorsrb/warnings-for-commit-headers
This is a try at extending the warning API to include warnings
that would be errors unless the user callback decides to demote
them to warnings. This allows for relaxed parsing logic that will
default to strict behavior but can continue if possible.
Diffstat (limited to 'include/git2/sys/warning.h')
-rw-r--r-- | include/git2/sys/warning.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/git2/sys/warning.h b/include/git2/sys/warning.h index ec1262a6b..02adfbe40 100644 --- a/include/git2/sys/warning.h +++ b/include/git2/sys/warning.h @@ -11,8 +11,10 @@ GIT_BEGIN_DECL typedef enum { GIT_WARNING_NONE = 0, - GIT_WARNING_INVALID_DATA__SIGNATURE_TIMESTAMP, - GIT_WARNING_INVALID_DATA__SIGNATURE_TIMEZONE, + GIT_WARNING_INVALID_DATA__SIGNATURE_TIMESTAMP, /* default continue */ + GIT_WARNING_INVALID_DATA__SIGNATURE_TIMEZONE, /* default continue */ + GIT_WARNING_INVALID_DATA__SIGNATURE_EMAIL_MISSING, /* default error */ + GIT_WARNING_INVALID_DATA__SIGNATURE_EMAIL_UNTERMINATED, /* error */ } git_warning_t; /** @@ -42,10 +44,13 @@ typedef struct { * It will be passed a warning structure describing the problem. * * @param warning A git_warning structure for the specific situation + * @param default_rval Default return code (i.e. <0 if warning defaults + * to error, 0 if defaults to no error) * @param payload The payload set when callback function was specified * @return 0 to continue, <0 to convert the warning to an error */ -typedef int (*git_warning_callback)(git_warning *warning, void *payload); +typedef int (*git_warning_callback)( + git_warning *warning, int default_rval, void *payload); /** * Set the callback to be invoked when an invalid but recoverable |