Disable t0110's high-bit test on Windows
[git/mingw/4msysgit.git] / graph.h
blob0be62bd8b1227a16b8e67f6309605d6f4a98c247
1 #ifndef GRAPH_H
2 #define GRAPH_H
4 /* A graph is a pointer to this opaque structure */
5 struct git_graph;
7 /*
8 * Set up a custom scheme for column colors.
10 * The default column color scheme inserts ANSI color escapes to colorize
11 * the graph. The various color escapes are stored in an array of strings
12 * where each entry corresponds to a color, except for the last entry,
13 * which denotes the escape for resetting the color back to the default.
14 * When generating the graph, strings from this array are inserted before
15 * and after the various column characters.
17 * This function allows you to enable a custom array of color escapes.
18 * The 'colors_max' argument is the index of the last "reset" entry.
20 * This functions must be called BEFORE graph_init() is called.
22 * NOTE: This function isn't used in Git outside graph.c but it is used
23 * by CGit (http://git.zx2c4.com/cgit/) to use HTML for colors.
25 void graph_set_column_colors(const char **colors, unsigned short colors_max);
28 * Create a new struct git_graph.
30 struct git_graph *graph_init(struct rev_info *opt);
33 * Update a git_graph with a new commit.
34 * This will cause the graph to begin outputting lines for the new commit
35 * the next time graph_next_line() is called.
37 * If graph_update() is called before graph_is_commit_finished() returns 1,
38 * the next call to graph_next_line() will output an ellipsis ("...")
39 * to indicate that a portion of the graph is missing.
41 void graph_update(struct git_graph *graph, struct commit *commit);
44 * Determine if a graph has finished outputting lines for the current
45 * commit.
47 * Returns 1 if graph_next_line() needs to be called again before
48 * graph_update() should be called. Returns 0 if no more lines are needed
49 * for this commit. If 0 is returned, graph_next_line() may still be
50 * called without calling graph_update(), and it will merely output
51 * appropriate "vertical padding" in the graph.
53 int graph_is_commit_finished(struct git_graph const *graph);
56 * Output the next line for a graph.
57 * This formats the next graph line into the specified strbuf. It is not
58 * terminated with a newline.
60 * Returns 1 if the line includes the current commit, and 0 otherwise.
61 * graph_next_line() will return 1 exactly once for each time
62 * graph_update() is called.
64 * NOTE: This function isn't used in Git outside graph.c but it is used
65 * by CGit (http://git.zx2c4.com/cgit/) to wrap HTML around graph lines.
67 int graph_next_line(struct git_graph *graph, struct strbuf *sb);
71 * graph_show_*: helper functions for printing to stdout
76 * If the graph is non-NULL, print the history graph to stdout,
77 * up to and including the line containing this commit.
78 * Does not print a terminating newline on the last line.
80 void graph_show_commit(struct git_graph *graph);
83 * If the graph is non-NULL, print one line of the history graph to stdout.
84 * Does not print a terminating newline on the last line.
86 void graph_show_oneline(struct git_graph *graph);
89 * If the graph is non-NULL, print one line of vertical graph padding to
90 * stdout. Does not print a terminating newline on the last line.
92 void graph_show_padding(struct git_graph *graph);
95 * If the graph is non-NULL, print the rest of the history graph for this
96 * commit to stdout. Does not print a terminating newline on the last line.
98 int graph_show_remainder(struct git_graph *graph);
101 * Print a commit message strbuf and the remainder of the graph to stdout.
103 * This is similar to graph_show_strbuf(), but it always prints the
104 * remainder of the graph.
106 * If the strbuf ends with a newline, the output printed by
107 * graph_show_commit_msg() will end with a newline. If the strbuf is
108 * missing a terminating newline (including if it is empty), the output
109 * printed by graph_show_commit_msg() will also be missing a terminating
110 * newline.
112 void graph_show_commit_msg(struct git_graph *graph, struct strbuf const *sb);
114 #endif /* GRAPH_H */