commit: make ignore_non_trailer() non static
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Nov 9, 2014 at 10:23 UTC
8c3845892363abf3fb5cf2fe61bc455554f50c68
3 files changed
+49
-46
builtin/commit.c
-46
@@ -669,52 +669,6 @@ static void adjust_comment_line_char(const struct strbuf *sb)
669
comment_line_char = *p;
670
}
671
672
-/*
673
- * Inspect sb and determine the true "end" of the log message, in
674
- * order to find where to put a new Signed-off-by: line. Ignored are
675
- * trailing comment lines and blank lines, and also the traditional
676
- * "Conflicts:" block that is not commented out, so that we can use
677
- * "git commit -s --amend" on an existing commit that forgot to remove
678
- * it.
679
- *
680
- * Returns the number of bytes from the tail to ignore, to be fed as
681
- * the second parameter to append_signoff().
682
- */
683
-static int ignore_non_trailer(struct strbuf *sb)
684
-{
685
- int boc = 0;
686
- int bol = 0;
687
- int in_old_conflicts_block = 0;
688
-
689
- while (bol < sb->len) {
690
- char *next_line;
691
-
692
- if (!(next_line = memchr(sb->buf + bol, '\n', sb->len - bol)))
693
- next_line = sb->buf + sb->len;
694
- else
695
- next_line++;
696
-
697
- if (sb->buf[bol] == comment_line_char || sb->buf[bol] == '\n') {
698
- /* is this the first of the run of comments? */
699
- if (!boc)
700
- boc = bol;
701
- /* otherwise, it is just continuing */
702
- } else if (starts_with(sb->buf + bol, "Conflicts:\n")) {
703
- in_old_conflicts_block = 1;
704
- if (!boc)
705
- boc = bol;
706
- } else if (in_old_conflicts_block && sb->buf[bol] == '\t') {
707
- ; /* a pathname in the conflicts block */
708
- } else if (boc) {
709
- /* the previous was not trailing comment */
710
- boc = 0;
711
- in_old_conflicts_block = 0;
712
- }
713
- bol = next_line - sb->buf;
714
- }
715
- return boc ? sb->len - boc : 0;
716
-}
717
-
672
static int prepare_to_commit(const char *index_file, const char *prefix,
673
struct commit *current_head,
674
struct wt_status *s,
commit.c
+46
@@ -1660,3 +1660,49 @@ void print_commit_list(struct commit_list *list,
1660
printf(format, sha1_to_hex(list->item->object.sha1));
1661
}
1662
}
1663
+
1664
+/*
1665
+ * Inspect sb and determine the true "end" of the log message, in
1666
+ * order to find where to put a new Signed-off-by: line. Ignored are
1667
+ * trailing comment lines and blank lines, and also the traditional
1668
+ * "Conflicts:" block that is not commented out, so that we can use
1669
+ * "git commit -s --amend" on an existing commit that forgot to remove
1670
+ * it.
1671
+ *
1672
+ * Returns the number of bytes from the tail to ignore, to be fed as
1673
+ * the second parameter to append_signoff().
1674
+ */
1675
+int ignore_non_trailer(struct strbuf *sb)
1676
+{
1677
+ int boc = 0;
1678
+ int bol = 0;
1679
+ int in_old_conflicts_block = 0;
1680
+
1681
+ while (bol < sb->len) {
1682
+ char *next_line;
1683
+
1684
+ if (!(next_line = memchr(sb->buf + bol, '\n', sb->len - bol)))
1685
+ next_line = sb->buf + sb->len;
1686
+ else
1687
+ next_line++;
1688
+
1689
+ if (sb->buf[bol] == comment_line_char || sb->buf[bol] == '\n') {
1690
+ /* is this the first of the run of comments? */
1691
+ if (!boc)
1692
+ boc = bol;
1693
+ /* otherwise, it is just continuing */
1694
+ } else if (starts_with(sb->buf + bol, "Conflicts:\n")) {
1695
+ in_old_conflicts_block = 1;
1696
+ if (!boc)
1697
+ boc = bol;
1698
+ } else if (in_old_conflicts_block && sb->buf[bol] == '\t') {
1699
+ ; /* a pathname in the conflicts block */
1700
+ } else if (boc) {
1701
+ /* the previous was not trailing comment */
1702
+ boc = 0;
1703
+ in_old_conflicts_block = 0;
1704
+ }
1705
+ bol = next_line - sb->buf;
1706
+ }
1707
+ return boc ? sb->len - boc : 0;
1708
+}
commit.h
+3
@@ -326,6 +326,9 @@ extern struct commit_extra_header *read_commit_extra_headers(struct commit *, co
326
327
extern void free_commit_extra_headers(struct commit_extra_header *extra);
328
329
+/* Find the end of the log message, the right place for a new trailer. */
330
+extern int ignore_non_trailer(struct strbuf *sb);
331
+
332
typedef void (*each_mergetag_fn)(struct commit *commit, struct commit_extra_header *extra,
333
void *cb_data);
334