Support Unicode console output on Windows
[git/dscho.git] / graph.h
blob19b0f6631654f428cb76e9493325646163899a0b
1 #ifndef GRAPH_H
2 #define GRAPH_H
4 /* A graph is a pointer to this opaque structure */
5 struct git_graph;
8 /*
9 * Create a new struct git_graph.
11 struct git_graph *graph_init(struct rev_info *opt);
14 * Update a git_graph with a new commit.
15 * This will cause the graph to begin outputting lines for the new commit
16 * the next time graph_next_line() is called.
18 * If graph_update() is called before graph_is_commit_finished() returns 1,
19 * the next call to graph_next_line() will output an ellipsis ("...")
20 * to indicate that a portion of the graph is missing.
22 void graph_update(struct git_graph *graph, struct commit *commit);
25 * Determine if a graph has finished outputting lines for the current
26 * commit.
28 * Returns 1 if graph_next_line() needs to be called again before
29 * graph_update() should be called. Returns 0 if no more lines are needed
30 * for this commit. If 0 is returned, graph_next_line() may still be
31 * called without calling graph_update(), and it will merely output
32 * appropriate "vertical padding" in the graph.
34 int graph_is_commit_finished(struct git_graph const *graph);
38 * graph_show_*: helper functions for printing to stdout
43 * If the graph is non-NULL, print the history graph to stdout,
44 * up to and including the line containing this commit.
45 * Does not print a terminating newline on the last line.
47 void graph_show_commit(struct git_graph *graph);
50 * If the graph is non-NULL, print one line of the history graph to stdout.
51 * Does not print a terminating newline on the last line.
53 void graph_show_oneline(struct git_graph *graph);
56 * If the graph is non-NULL, print one line of vertical graph padding to
57 * stdout. Does not print a terminating newline on the last line.
59 void graph_show_padding(struct git_graph *graph);
62 * If the graph is non-NULL, print the rest of the history graph for this
63 * commit to stdout. Does not print a terminating newline on the last line.
65 int graph_show_remainder(struct git_graph *graph);
68 * Print a commit message strbuf and the remainder of the graph to stdout.
70 * This is similar to graph_show_strbuf(), but it always prints the
71 * remainder of the graph.
73 * If the strbuf ends with a newline, the output printed by
74 * graph_show_commit_msg() will end with a newline. If the strbuf is
75 * missing a terminating newline (including if it is empty), the output
76 * printed by graph_show_commit_msg() will also be missing a terminating
77 * newline.
79 void graph_show_commit_msg(struct git_graph *graph, struct strbuf const *sb);
81 #endif /* GRAPH_H */