pack-objects: use reachability bitmap index when generating non-stdout pack
[gitweb.git] / graph.c
diff --git a/graph.c b/graph.c
index ad766facad65e174b4354ab969cef715ad687470..dd1720148dc51740c96da0f4b17b59b97994abac 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -17,8 +17,8 @@
 static void graph_padding_line(struct git_graph *graph, struct strbuf *sb);
 
 /*
- * Print a strbuf to stdout.  If the graph is non-NULL, all lines but the
- * first will be prefixed with the graph output.
+ * 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.
@@ -1200,9 +1200,10 @@ void graph_show_commit(struct git_graph *graph)
 
        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);
+               fwrite(msgbuf.buf, sizeof(char), msgbuf.len,
+                       graph->revs->diffopt.file);
                if (!shown_commit_line)
-                       putchar('\n');
+                       putc('\n', graph->revs->diffopt.file);
                strbuf_setlen(&msgbuf, 0);
        }
 
@@ -1217,7 +1218,7 @@ void graph_show_oneline(struct git_graph *graph)
                return;
 
        graph_next_line(graph, &msgbuf);
-       fwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);
+       fwrite(msgbuf.buf, sizeof(char), msgbuf.len, graph->revs->diffopt.file);
        strbuf_release(&msgbuf);
 }
 
@@ -1229,7 +1230,7 @@ void graph_show_padding(struct git_graph *graph)
                return;
 
        graph_padding_line(graph, &msgbuf);
-       fwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);
+       fwrite(msgbuf.buf, sizeof(char), msgbuf.len, graph->revs->diffopt.file);
        strbuf_release(&msgbuf);
 }
 
@@ -1246,12 +1247,13 @@ int graph_show_remainder(struct git_graph *graph)
 
        for (;;) {
                graph_next_line(graph, &msgbuf);
-               fwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);
+               fwrite(msgbuf.buf, sizeof(char), msgbuf.len,
+                       graph->revs->diffopt.file);
                strbuf_setlen(&msgbuf, 0);
                shown = 1;
 
                if (!graph_is_commit_finished(graph))
-                       putchar('\n');
+                       putc('\n', graph->revs->diffopt.file);
                else
                        break;
        }
@@ -1266,7 +1268,8 @@ static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb)
        char *p;
 
        if (!graph) {
-               fwrite(sb->buf, sizeof(char), sb->len, stdout);
+               fwrite(sb->buf, sizeof(char), sb->len,
+                       graph->revs->diffopt.file);
                return;
        }
 
@@ -1284,7 +1287,7 @@ static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb)
                } else {
                        len = (sb->buf + sb->len) - p;
                }
-               fwrite(p, sizeof(char), len, stdout);
+               fwrite(p, sizeof(char), len, graph->revs->diffopt.file);
                if (next_p && *next_p != '\0')
                        graph_show_oneline(graph);
                p = next_p;
@@ -1304,7 +1307,8 @@ void graph_show_commit_msg(struct git_graph *graph,
                 * CMIT_FMT_USERFORMAT are already missing a terminating
                 * newline.  All of the other formats should have it.
                 */
-               fwrite(sb->buf, sizeof(char), sb->len, stdout);
+               fwrite(sb->buf, sizeof(char), sb->len,
+                       graph->revs->diffopt.file);
                return;
        }
 
@@ -1325,7 +1329,7 @@ void graph_show_commit_msg(struct git_graph *graph,
                 * new line.
                 */
                if (!newline_terminated)
-                       putchar('\n');
+                       putc('\n', graph->revs->diffopt.file);
 
                graph_show_remainder(graph);
 
@@ -1333,6 +1337,6 @@ void graph_show_commit_msg(struct git_graph *graph,
                 * If sb ends with a newline, our output should too.
                 */
                if (newline_terminated)
-                       putchar('\n');
+                       putc('\n', graph->revs->diffopt.file);
        }
 }