From d0aaa46fd3e53801346a4cadebf398f05d79780b Mon Sep 17 00:00:00 2001 From: Phillip Wood Date: Fri, 10 Nov 2017 11:09:42 +0000 Subject: commit: move empty message checks to libgit Move the functions that check for empty messages from bulitin/commit.c to sequencer.c so they can be shared with other commands. The functions are refactored to take an explicit cleanup mode and template filename passed by the caller. Signed-off-by: Phillip Wood Signed-off-by: Junio C Hamano --- sequencer.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sequencer.h') diff --git a/sequencer.h b/sequencer.h index 6f3d3df82c..82e57713a2 100644 --- a/sequencer.h +++ b/sequencer.h @@ -58,4 +58,15 @@ extern const char sign_off_header[]; void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag); void append_conflicts_hint(struct strbuf *msgbuf); +enum commit_msg_cleanup_mode { + COMMIT_MSG_CLEANUP_SPACE, + COMMIT_MSG_CLEANUP_NONE, + COMMIT_MSG_CLEANUP_SCISSORS, + COMMIT_MSG_CLEANUP_ALL +}; + +int message_is_empty(const struct strbuf *sb, + enum commit_msg_cleanup_mode cleanup_mode); +int template_untouched(const struct strbuf *sb, const char *template_file, + enum commit_msg_cleanup_mode cleanup_mode); #endif -- cgit v1.3-5-g9baa