Builtin-ify git-notes
[git/mingw.git] / graph.h
blobb82ae87a491454aa119476ac9609ad176e8c9406
1 #ifndef GRAPH_H
2 #define GRAPH_H
4 /* A graph is a pointer to this opaque structure */
5 struct git_graph;
7 /*
8 * Create a new struct git_graph.
9 */
10 struct git_graph *graph_init(struct rev_info *opt);
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.
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.
21 void graph_update(struct git_graph *graph, struct commit *commit);
24 * Determine if a graph has finished outputting lines for the current
25 * commit.
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.
33 int graph_is_commit_finished(struct git_graph const *graph);
37 * graph_show_*: helper functions for printing to stdout
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.
46 void graph_show_commit(struct git_graph *graph);
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.
52 void graph_show_oneline(struct git_graph *graph);
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.
58 void graph_show_padding(struct git_graph *graph);
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.
64 int graph_show_remainder(struct git_graph *graph);
67 * Print a commit message strbuf and the remainder of the graph to stdout.
69 * This is similar to graph_show_strbuf(), but it always prints the
70 * remainder of the graph.
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.
78 void graph_show_commit_msg(struct git_graph *graph, struct strbuf const *sb);
80 #endif /* GRAPH_H */