From 47d4676ac8a50b7d53e12ae200ed9b5661522129 Mon Sep 17 00:00:00 2001 From: Hariom Verma Date: Fri, 21 Aug 2020 21:41:49 +0000 Subject: pretty: refactor `format_sanitized_subject()` The function 'format_sanitized_subject()' is responsible for sanitized subject line in pretty.c e.g. the subject line the-sanitized-subject-line It would be a nice enhancement to `subject` atom to have the same feature. So in the later commits, we plan to add this feature to ref-filter. Refactor `format_sanitized_subject()`, so it can be reused in ref-filter.c for adding new modifier `sanitize` to "subject" atom. Currently, the loop inside `format_sanitized_subject()` runs until `\n` is found. But now, we stored the first occurrence of `\n` in a variable `eol` and passed it in `format_sanitized_subject()`. And the loop runs upto `eol`. Mentored-by: Christian Couder Mentored-by: Heba Waly Signed-off-by: Hariom Verma Signed-off-by: Junio C Hamano --- pretty.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pretty.h') diff --git a/pretty.h b/pretty.h index 071f2fb8e4..7ce6c0b437 100644 --- a/pretty.h +++ b/pretty.h @@ -139,4 +139,7 @@ const char *format_subject(struct strbuf *sb, const char *msg, /* Check if "cmit_fmt" will produce an empty output. */ int commit_format_is_empty(enum cmit_fmt); +/* Make subject of commit message suitable for filename */ +void format_sanitized_subject(struct strbuf *sb, const char *msg, size_t len); + #endif /* PRETTY_H */ -- cgit v1.2.3