]> git.ipfire.org Git - thirdparty/git.git/blame - graph.h
t/README: A new section about test coverage
[thirdparty/git.git] / graph.h
CommitLineData
c12172d2
AS
1#ifndef GRAPH_H
2#define GRAPH_H
3
4/* A graph is a pointer to this opaque structure */
5struct git_graph;
6
7/*
8 * Create a new struct git_graph.
c12172d2 9 */
7528f27d 10struct git_graph *graph_init(struct rev_info *opt);
c12172d2 11
c12172d2
AS
12/*
13 * Update a git_graph with a new commit.
14 * This will cause the graph to begin outputting lines for the new commit
15 * the next time graph_next_line() is called.
16 *
17 * If graph_update() is called before graph_is_commit_finished() returns 1,
18 * the next call to graph_next_line() will output an ellipsis ("...")
19 * to indicate that a portion of the graph is missing.
20 */
21void graph_update(struct git_graph *graph, struct commit *commit);
22
c12172d2
AS
23/*
24 * Determine if a graph has finished outputting lines for the current
25 * commit.
26 *
27 * Returns 1 if graph_next_line() needs to be called again before
28 * graph_update() should be called. Returns 0 if no more lines are needed
29 * for this commit. If 0 is returned, graph_next_line() may still be
30 * called without calling graph_update(), and it will merely output
31 * appropriate "vertical padding" in the graph.
32 */
33int graph_is_commit_finished(struct git_graph const *graph);
34
35
36/*
37 * graph_show_*: helper functions for printing to stdout
38 */
39
40
41/*
42 * If the graph is non-NULL, print the history graph to stdout,
43 * up to and including the line containing this commit.
44 * Does not print a terminating newline on the last line.
45 */
46void graph_show_commit(struct git_graph *graph);
47
48/*
49 * If the graph is non-NULL, print one line of the history graph to stdout.
50 * Does not print a terminating newline on the last line.
51 */
52void graph_show_oneline(struct git_graph *graph);
53
54/*
55 * If the graph is non-NULL, print one line of vertical graph padding to
56 * stdout. Does not print a terminating newline on the last line.
57 */
58void graph_show_padding(struct git_graph *graph);
59
60/*
61 * If the graph is non-NULL, print the rest of the history graph for this
62 * commit to stdout. Does not print a terminating newline on the last line.
63 */
64int graph_show_remainder(struct git_graph *graph);
65
c12172d2
AS
66/*
67 * Print a commit message strbuf and the remainder of the graph to stdout.
68 *
69 * This is similar to graph_show_strbuf(), but it always prints the
70 * remainder of the graph.
71 *
72 * If the strbuf ends with a newline, the output printed by
73 * graph_show_commit_msg() will end with a newline. If the strbuf is
74 * missing a terminating newline (including if it is empty), the output
75 * printed by graph_show_commit_msg() will also be missing a terminating
76 * newline.
77 */
78void graph_show_commit_msg(struct git_graph *graph, struct strbuf const *sb);
79
80#endif /* GRAPH_H */