summaryrefslogtreecommitdiff
path: root/src/message.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-05-18 10:06:49 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-05-18 10:06:49 +0200
commit49e369b29d5bde227b162dd4681ecccff2f443df (patch)
tree30693d4febf21d5bfa2ba2aa1a8a4b31736f5886 /src/message.c
parentd7a294633dc6420d2411500bd40c7dfd2aa76d37 (diff)
downloadlibgit2-49e369b29d5bde227b162dd4681ecccff2f443df.tar.gz
message: don't assume the comment charcmn/comment-char
The comment char is configurable and we need to provide a way for the user to specify which comment char they chose for their message.
Diffstat (limited to 'src/message.c')
-rw-r--r--src/message.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/message.c b/src/message.c
index 07b2569ad..6c5a2379f 100644
--- a/src/message.c
+++ b/src/message.c
@@ -21,7 +21,7 @@ static size_t line_length_without_trailing_spaces(const char *line, size_t len)
/* Greatly inspired from git.git "stripspace" */
/* see https://github.com/git/git/blob/497215d8811ac7b8955693ceaad0899ecd894ed2/builtin/stripspace.c#L4-67 */
-int git_message_prettify(git_buf *message_out, const char *message, int strip_comments)
+int git_message_prettify(git_buf *message_out, const char *message, int strip_comments, char comment_char)
{
const size_t message_len = strlen(message);
@@ -40,7 +40,7 @@ int git_message_prettify(git_buf *message_out, const char *message, int strip_co
line_length = message_len - i;
}
- if (strip_comments && line_length && message[i] == '#')
+ if (strip_comments && line_length && message[i] == comment_char)
continue;
rtrimmed_line_length = line_length_without_trailing_spaces(message + i, line_length);