@matheusbsbs / matheus-bagliano / commits / a010966844
Fork 0

pretty: factor out skip_empty_lines()

The patch after the next one will use it. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Dec 27, 2008 at 01:32 UTC a010966844221ea14f1de26fdab8fe37332ff928
1 file changed +15 -9
pretty.c
+15 -9
@@ -181,6 +181,20 @@ static int is_empty_line(const char *line, int *len_p)
181 return !len;
182 }
183
184 +static const char *skip_empty_lines(const char *msg)
185 +{
186 + for (;;) {
187 + int linelen = get_one_line(msg);
188 + int ll = linelen;
189 + if (!linelen)
190 + break;
191 + if (!is_empty_line(msg, &ll))
192 + break;
193 + msg += linelen;
194 + }
195 + return msg;
196 +}
197 +
198 static void add_merge_info(enum cmit_fmt fmt, struct strbuf *sb,
199 const struct commit *commit, int abbrev)
200 {
@@ -850,15 +864,7 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
864 }
865
866 /* Skip excess blank lines at the beginning of body, if any... */
853 - for (;;) {
854 - int linelen = get_one_line(msg);
855 - int ll = linelen;
856 - if (!linelen)
857 - break;
858 - if (!is_empty_line(msg, &ll))
859 - break;
860 - msg += linelen;
861 - }
867 + msg = skip_empty_lines(msg);
868
869 /* These formats treat the title line specially. */
870 if (fmt == CMIT_FMT_ONELINE || fmt == CMIT_FMT_EMAIL)