Skip to content

Commit 25396a5

Browse files
committed
Merge branch 'jk/graph-c-expose-symbols-for-cgit' into maint
In the v1.8.0 era, we changed symbols that do not have to be global to file scope static, but a few functions in graph.c were used by CGit from sideways bypassing the entry points of the API the in-tree users use. * jk/graph-c-expose-symbols-for-cgit: Revert "graph.c: mark private file-scope symbols as static"
2 parents f7b1ad8 + ac751a0 commit 25396a5

File tree

2 files changed

+35
-30
lines changed

2 files changed

+35
-30
lines changed

graph.c

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,6 @@
77

88
/* Internal API */
99

10-
/*
11-
* Output the next line for a graph.
12-
* This formats the next graph line into the specified strbuf. It is not
13-
* terminated with a newline.
14-
*
15-
* Returns 1 if the line includes the current commit, and 0 otherwise.
16-
* graph_next_line() will return 1 exactly once for each time
17-
* graph_update() is called.
18-
*/
19-
static int graph_next_line(struct git_graph *graph, struct strbuf *sb);
20-
21-
/*
22-
* Set up a custom scheme for column colors.
23-
*
24-
* The default column color scheme inserts ANSI color escapes to colorize
25-
* the graph. The various color escapes are stored in an array of strings
26-
* where each entry corresponds to a color, except for the last entry,
27-
* which denotes the escape for resetting the color back to the default.
28-
* When generating the graph, strings from this array are inserted before
29-
* and after the various column characters.
30-
*
31-
* This function allows you to enable a custom array of color escapes.
32-
* The 'colors_max' argument is the index of the last "reset" entry.
33-
*
34-
* This functions must be called BEFORE graph_init() is called.
35-
*/
36-
static void graph_set_column_colors(const char **colors, unsigned short colors_max);
37-
3810
/*
3911
* Output a padding line in the graph.
4012
* This is similar to graph_next_line(). However, it is guaranteed to
@@ -90,7 +62,7 @@ enum graph_state {
9062
static const char **column_colors;
9163
static unsigned short column_colors_max;
9264

93-
static void graph_set_column_colors(const char **colors, unsigned short colors_max)
65+
void graph_set_column_colors(const char **colors, unsigned short colors_max)
9466
{
9567
column_colors = colors;
9668
column_colors_max = colors_max;
@@ -1144,7 +1116,7 @@ static void graph_output_collapsing_line(struct git_graph *graph, struct strbuf
11441116
graph_update_state(graph, GRAPH_PADDING);
11451117
}
11461118

1147-
static int graph_next_line(struct git_graph *graph, struct strbuf *sb)
1119+
int graph_next_line(struct git_graph *graph, struct strbuf *sb)
11481120
{
11491121
switch (graph->state) {
11501122
case GRAPH_PADDING:

graph.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44
/* A graph is a pointer to this opaque structure */
55
struct git_graph;
66

7+
/*
8+
* Set up a custom scheme for column colors.
9+
*
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.
16+
*
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.
19+
*
20+
* This functions must be called BEFORE graph_init() is called.
21+
*
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.
24+
*/
25+
void graph_set_column_colors(const char **colors, unsigned short colors_max);
726

827
/*
928
* Create a new struct git_graph.
@@ -33,6 +52,20 @@ void graph_update(struct git_graph *graph, struct commit *commit);
3352
*/
3453
int graph_is_commit_finished(struct git_graph const *graph);
3554

55+
/*
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.
59+
*
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.
63+
*
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.
66+
*/
67+
int graph_next_line(struct git_graph *graph, struct strbuf *sb);
68+
3669

3770
/*
3871
* graph_show_*: helper functions for printing to stdout

0 commit comments

Comments
 (0)