aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-01-14 07:32:18 -0800
committerJunio C Hamano <gitster@pobox.com>2013-01-14 07:32:18 -0800
commit6cf0a9e9fc90be167c3b2e0cda1ec67909c89ca7 (patch)
tree9304a2af6e54ba14d1f80a5524429a45800e2e42
parentab60f2ce2ddd1e0199dbc778bfb054a532badde0 (diff)
parent656197ad380506ca0e8a0355701f9d9a4a398f66 (diff)
downloadgit-6cf0a9e9fc90be167c3b2e0cda1ec67909c89ca7.tar.gz
git-6cf0a9e9fc90be167c3b2e0cda1ec67909c89ca7.tar.xz
Merge branch 'mk/maint-graph-infinity-loop' into maint
* mk/maint-graph-infinity-loop: graph.c: infinite loop in git whatchanged --graph -m
-rw-r--r--Documentation/technical/api-history-graph.txt10
-rw-r--r--graph.c2
-rwxr-xr-xt/t4202-log.sh10
3 files changed, 16 insertions, 6 deletions
diff --git a/Documentation/technical/api-history-graph.txt b/Documentation/technical/api-history-graph.txt
index d6fc90ac7..18142b6d2 100644
--- a/Documentation/technical/api-history-graph.txt
+++ b/Documentation/technical/api-history-graph.txt
@@ -33,11 +33,11 @@ The following utility functions are wrappers around `graph_next_line()` and
They can all be called with a NULL graph argument, in which case no graph
output will be printed.
-* `graph_show_commit()` calls `graph_next_line()` until it returns non-zero.
- This prints all graph lines up to, and including, the line containing this
- commit. Output is printed to stdout. The last line printed does not contain
- a terminating newline. This should not be called if the commit line has
- already been printed, or it will loop forever.
+* `graph_show_commit()` calls `graph_next_line()` and
+ `graph_is_commit_finished()` until one of them return non-zero. This prints
+ all graph lines up to, and including, the line containing this commit.
+ Output is printed to stdout. The last line printed does not contain a
+ terminating newline.
* `graph_show_oneline()` calls `graph_next_line()` and prints the result to
stdout. The line printed does not contain a terminating newline.
diff --git a/graph.c b/graph.c
index e864fe2c6..391a712e5 100644
--- a/graph.c
+++ b/graph.c
@@ -1227,7 +1227,7 @@ void graph_show_commit(struct git_graph *graph)
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 --git a/t/t4202-log.sh b/t/t4202-log.sh
index a343bf6c6..fa686b887 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -280,6 +280,16 @@ test_expect_success 'log --graph with merge' '
test_cmp expect actual
'
+test_expect_success 'log --raw --graph -m with merge' '
+ git log --raw --graph --oneline -m master | head -n 500 >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