git/graph.c

#define USE_THE_REPOSITORY_VARIABLE

#include "git-compat-util.h"
#include "gettext.h"
#include "config.h"
#include "commit.h"
#include "color.h"
#include "graph.h"
#include "revision.h"
#include "strvec.h"

/* Internal API */

/*
 * Output a padding line in the graph.
 * This is similar to graph_next_line().  However, it is guaranteed to
 * never print the current commit line.  Instead, if the commit line is
 * next, it will simply output a line of vertical padding, extending the
 * branch lines downwards, but leaving them otherwise unchanged.
 */
static void graph_padding_line(struct git_graph *graph, struct strbuf *sb);

/*
 * Print a strbuf.  If the graph is non-NULL, all lines but the first will be
 * prefixed with the graph output.
 *
 * If the strbuf ends with a newline, the output will end after this
 * newline.  A new graph line will not be printed after the final newline.
 * If the strbuf is empty, no output will be printed.
 *
 * Since the first line will not include the graph output, the caller is
 * responsible for printing this line's graph (perhaps via
 * graph_show_commit() or graph_show_oneline()) before calling
 * graph_show_strbuf().
 *
 * Note that unlike some other graph display functions, you must pass the file
 * handle directly. It is assumed that this is the same file handle as the
 * file specified by the graph diff options. This is necessary so that
 * graph_show_strbuf can be called even with a NULL graph.
 * If a NULL graph is supplied, the strbuf is printed as-is.
 */
static void graph_show_strbuf(struct git_graph *graph,
			      FILE *file,
			      struct strbuf const *sb);

/*
 * TODO:
 * - Limit the number of columns, similar to the way gitk does.
 *   If we reach more than a specified number of columns, omit
 *   sections of some columns.
 */

struct column {};

enum graph_state {};

static void graph_show_line_prefix(const struct diff_options *diffopt)
{}

static const char **column_colors;
static unsigned short column_colors_max;

static void parse_graph_colors_config(struct strvec *colors, const char *string)
{}

void graph_set_column_colors(const char **colors, unsigned short colors_max)
{}

static const char *column_get_color_code(unsigned short color)
{}

struct graph_line {};

static inline void graph_line_addch(struct graph_line *line, int c)
{}

static inline void graph_line_addchars(struct graph_line *line, int c, size_t n)
{}

static inline void graph_line_addstr(struct graph_line *line, const char *s)
{}

static inline void graph_line_addcolor(struct graph_line *line, unsigned short color)
{}

static void graph_line_write_column(struct graph_line *line, const struct column *c,
				    char col_char)
{}

struct git_graph {};

static const char *diff_output_prefix_callback(struct diff_options *opt, void *data)
{}

static const struct diff_options *default_diffopt;

void graph_setup_line_prefix(struct diff_options *diffopt)
{}

struct git_graph *graph_init(struct rev_info *opt)
{}

void graph_clear(struct git_graph *graph)
{}

static void graph_update_state(struct git_graph *graph, enum graph_state s)
{}

static void graph_ensure_capacity(struct git_graph *graph, int num_columns)
{}

/*
 * Returns 1 if the commit will be printed in the graph output,
 * and 0 otherwise.
 */
static int graph_is_interesting(struct git_graph *graph, struct commit *commit)
{}

static struct commit_list *next_interesting_parent(struct git_graph *graph,
						   struct commit_list *orig)
{}

static struct commit_list *first_interesting_parent(struct git_graph *graph)
{}

static unsigned short graph_get_current_column_color(const struct git_graph *graph)
{}

/*
 * Update the graph's default column color.
 */
static void graph_increment_column_color(struct git_graph *graph)
{}

static unsigned short graph_find_commit_color(const struct git_graph *graph,
					      const struct commit *commit)
{}

static int graph_find_new_column_by_commit(struct git_graph *graph,
					   struct commit *commit)
{}

static void graph_insert_into_new_columns(struct git_graph *graph,
					  struct commit *commit,
					  int idx)
{}

static void graph_update_columns(struct git_graph *graph)
{}

static int graph_num_dashed_parents(struct git_graph *graph)
{}

static int graph_num_expansion_rows(struct git_graph *graph)
{}

static int graph_needs_pre_commit_line(struct git_graph *graph)
{}

void graph_update(struct git_graph *graph, struct commit *commit)
{}

static int graph_is_mapping_correct(struct git_graph *graph)
{}

static void graph_pad_horizontally(struct git_graph *graph, struct graph_line *line)
{}

static void graph_output_padding_line(struct git_graph *graph,
				      struct graph_line *line)
{}


int graph_width(struct git_graph *graph)
{}


static void graph_output_skip_line(struct git_graph *graph, struct graph_line *line)
{}

static void graph_output_pre_commit_line(struct git_graph *graph,
					 struct graph_line *line)
{}

static void graph_output_commit_char(struct git_graph *graph, struct graph_line *line)
{}

/*
 * Draw the horizontal dashes of an octopus merge.
 */
static void graph_draw_octopus_merge(struct git_graph *graph, struct graph_line *line)
{}

static void graph_output_commit_line(struct git_graph *graph, struct graph_line *line)
{}

static const char merge_chars[] =;

static void graph_output_post_merge_line(struct git_graph *graph, struct graph_line *line)
{}

static void graph_output_collapsing_line(struct git_graph *graph, struct graph_line *line)
{}

int graph_next_line(struct git_graph *graph, struct strbuf *sb)
{}

static void graph_padding_line(struct git_graph *graph, struct strbuf *sb)
{}

int graph_is_commit_finished(struct git_graph const *graph)
{}

void graph_show_commit(struct git_graph *graph)
{}

void graph_show_oneline(struct git_graph *graph)
{}

void graph_show_padding(struct git_graph *graph)
{}

int graph_show_remainder(struct git_graph *graph)
{}

static void graph_show_strbuf(struct git_graph *graph,
			      FILE *file,
			      struct strbuf const *sb)
{}

void graph_show_commit_msg(struct git_graph *graph,
			   FILE *file,
			   struct strbuf const *sb)
{}