From: Junio C Hamano Date: Mon, 14 Jan 2013 15:32:18 +0000 (-0800) Subject: Merge branch 'mk/maint-graph-infinity-loop' into maint X-Git-Tag: v1.8.1.1~13 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6cf0a9e9fc90be167c3b2e0cda1ec67909c89ca7?ds=inline;hp=-c Merge branch 'mk/maint-graph-infinity-loop' into maint * mk/maint-graph-infinity-loop: graph.c: infinite loop in git whatchanged --graph -m --- 6cf0a9e9fc90be167c3b2e0cda1ec67909c89ca7 diff --combined graph.c index e864fe2c6a,d92868ba12..391a712e5e --- a/graph.c +++ b/graph.c @@@ -7,34 -7,6 +7,34 @@@ /* Internal API */ +/* + * Output the next line for a graph. + * This formats the next graph line into the specified strbuf. It is not + * terminated with a newline. + * + * Returns 1 if the line includes the current commit, and 0 otherwise. + * graph_next_line() will return 1 exactly once for each time + * graph_update() is called. + */ +static int graph_next_line(struct git_graph *graph, struct strbuf *sb); + +/* + * Set up a custom scheme for column colors. + * + * The default column color scheme inserts ANSI color escapes to colorize + * the graph. The various color escapes are stored in an array of strings + * where each entry corresponds to a color, except for the last entry, + * which denotes the escape for resetting the color back to the default. + * When generating the graph, strings from this array are inserted before + * and after the various column characters. + * + * This function allows you to enable a custom array of color escapes. + * The 'colors_max' argument is the index of the last "reset" entry. + * + * This functions must be called BEFORE graph_init() is called. + */ +static void graph_set_column_colors(const char **colors, unsigned short colors_max); + /* * Output a padding line in the graph. * This is similar to graph_next_line(). However, it is guaranteed to @@@ -90,7 -62,7 +90,7 @@@ enum graph_state static const char **column_colors; static unsigned short column_colors_max; -void graph_set_column_colors(const char **colors, unsigned short colors_max) +static void graph_set_column_colors(const char **colors, unsigned short colors_max) { column_colors = colors; column_colors_max = colors_max; @@@ -1144,7 -1116,7 +1144,7 @@@ static void graph_output_collapsing_lin graph_update_state(graph, GRAPH_PADDING); } -int graph_next_line(struct git_graph *graph, struct strbuf *sb) +static int graph_next_line(struct git_graph *graph, struct strbuf *sb) { switch (graph->state) { case GRAPH_PADDING: @@@ -1227,7 -1199,7 +1227,7 @@@ void graph_show_commit(struct git_grap if (!graph) return; - while (!shown_commit_line) { + while (!shown_commit_line && !graph_is_commit_finished(graph)) { shown_commit_line = graph_next_line(graph, &msgbuf); fwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout); if (!shown_commit_line) diff --combined t/t4202-log.sh index a343bf6c62,14f73e3bac..fa686b887d --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@@ -72,9 -72,9 +72,9 @@@ cat > expect << EO commit. EOF -test_expect_success 'format %w(12,1,2)' ' +test_expect_success 'format %w(11,1,2)' ' - git log -2 --format="%w(12,1,2)This is the %s commit." > actual && + git log -2 --format="%w(11,1,2)This is the %s commit." > actual && test_cmp expect actual ' @@@ -178,21 -178,11 +178,21 @@@ test_expect_success 'git log --no-walk test_cmp expect actual ' +test_expect_success 'git log --no-walk=sorted sorts by commit time' ' + git log --no-walk=sorted --oneline 5d31159 804a787 394ef78 > actual && + test_cmp expect actual +' + cat > expect << EOF 5d31159 fourth 804a787 sixth 394ef78 fifth EOF +test_expect_success 'git log --no-walk=unsorted leaves list of commits as given' ' + git log --no-walk=unsorted --oneline 5d31159 804a787 394ef78 > actual && + test_cmp expect actual +' + test_expect_success 'git show leaves list of commits as given' ' git show --oneline -s 5d31159 804a787 394ef78 > actual && test_cmp expect actual @@@ -230,12 -220,6 +230,12 @@@ test_expect_success 'log --grep -i' test_cmp expect actual ' +test_expect_success 'log -F -E --grep= uses ere' ' + echo second >expect && + git log -1 --pretty="tformat:%s" -F -E --grep=s.c.nd >actual && + test_cmp expect actual +' + cat > expect <actual && + grep "initial" actual + ' + + test_expect_success 'diff-tree --graph' ' + git diff-tree --graph master^ | head -n 500 >actual && + grep "one" actual + ' + cat > expect <<\EOF * commit master |\ Merge: A B @@@ -819,14 -813,7 +829,14 @@@ sanitize_output () test_expect_success 'log --graph with diff and stats' ' git log --graph --pretty=short --stat -p >actual && sanitize_output >actual.sanitized expect && + ( cd a/b && git log --format=%s .. ) >actual && + test_cmp expect actual ' test_done