format: create docs for pretty.h
Write some docs for functions in pretty.h. Take it as a first draft, they would be changed later. Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com> Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Olga Telezhnaya committed
Dec 12, 2017 at 08:55 UTC
d0e63260261f166b1e19ae4050404a9a71934dbe
1 file changed
+44
pretty.h
+44
@@ -48,6 +48,7 @@ struct pretty_print_context {
48
int graph_width;
49
};
50
51
+/* Check whether commit format is mail. */
52
static inline int cmit_fmt_is_mail(enum cmit_fmt fmt)
53
{
54
return (fmt == CMIT_FMT_EMAIL || fmt == CMIT_FMT_MBOXRD);
@@ -57,31 +58,74 @@ struct userformat_want {
58
unsigned notes:1;
59
};
60
61
+/* Set the flag "w->notes" if there is placeholder %N in "fmt". */
62
void userformat_find_requirements(const char *fmt, struct userformat_want *w);
63
+
64
+/*
65
+ * Shortcut for invoking pretty_print_commit if we do not have any context.
66
+ * Context would be set empty except "fmt".
67
+ */
68
void pp_commit_easy(enum cmit_fmt fmt, const struct commit *commit,
69
struct strbuf *sb);
70
+
71
+/*
72
+ * Get information about user and date from "line", format it and
73
+ * put it into "sb".
74
+ * Format of "line" must be readable for split_ident_line function.
75
+ * The resulting format is "what: name <email> date".
76
+ */
77
void pp_user_info(struct pretty_print_context *pp, const char *what,
78
struct strbuf *sb, const char *line,
79
const char *encoding);
80
+
81
+/*
82
+ * Format title line of commit message taken from "msg_p" and
83
+ * put it into "sb".
84
+ * First line of "msg_p" is also affected.
85
+ */
86
void pp_title_line(struct pretty_print_context *pp, const char **msg_p,
87
struct strbuf *sb, const char *encoding,
88
int need_8bit_cte);
89
+
90
+/*
91
+ * Get current state of commit message from "msg_p" and continue formatting
92
+ * by adding indentation and '>' signs. Put result into "sb".
93
+ */
94
void pp_remainder(struct pretty_print_context *pp, const char **msg_p,
95
struct strbuf *sb, int indent);
96
97
+/*
98
+ * Create a text message about commit using given "format" and "context".
99
+ * Put the result to "sb".
100
+ * Please use this function for custom formats.
101
+ */
102
void format_commit_message(const struct commit *commit,
103
const char *format, struct strbuf *sb,
104
const struct pretty_print_context *context);
105
106
+/*
107
+ * Parse given arguments from "arg", check it for correctness and
108
+ * fill struct rev_info.
109
+ */
110
void get_commit_format(const char *arg, struct rev_info *);
111
112
+/*
113
+ * Make a commit message with all rules from given "pp"
114
+ * and put it into "sb".
115
+ * Please use this function if you have a context (candidate for "pp").
116
+ */
117
void pretty_print_commit(struct pretty_print_context *pp,
118
const struct commit *commit,
119
struct strbuf *sb);
120
121
+/*
122
+ * Change line breaks in "msg" to "line_separator" and put it into "sb".
123
+ * Return "msg" itself.
124
+ */
125
const char *format_subject(struct strbuf *sb, const char *msg,
126
const char *line_separator);
127
128
+/* Check if "cmit_fmt" will produce an empty output. */
129
int commit_format_is_empty(enum cmit_fmt);
130
131
#endif /* PRETTY_H */