Skip to content

Commit a010966

Browse files
René Scharfegitster
authored andcommitted
pretty: factor out skip_empty_lines()
The patch after the next one will use it. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8104ebf commit a010966

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

pretty.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,20 @@ static int is_empty_line(const char *line, int *len_p)
181181
return !len;
182182
}
183183

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+
184198
static void add_merge_info(enum cmit_fmt fmt, struct strbuf *sb,
185199
const struct commit *commit, int abbrev)
186200
{
@@ -850,15 +864,7 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
850864
}
851865

852866
/* 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);
862868

863869
/* These formats treat the title line specially. */
864870
if (fmt == CMIT_FMT_ONELINE || fmt == CMIT_FMT_EMAIL)

0 commit comments

Comments
 (0)