aboutsummaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2008-03-10 13:58:26 -0400
committerJunio C Hamano <gitster@pobox.com>2008-03-14 00:42:14 -0700
commit4ba0cb27c1c0c3aa65d28e1891c1f3dca3db5f93 (patch)
treed43d7942c9ab1062dde7369a02a51cae8356bfa4 /wt-status.c
parentc0c77734bf313455364b3be7d3537d40e1138bcc (diff)
downloadgit-4ba0cb27c1c0c3aa65d28e1891c1f3dca3db5f93.tar.gz
git-4ba0cb27c1c0c3aa65d28e1891c1f3dca3db5f93.tar.xz
wt-status.c: no need for dup() dance anymore
Now we can generate diff to a file descriptor, we do not have to dup() the stdout around when writing the status output. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/wt-status.c b/wt-status.c
index 701d13da7..b3fd57b79 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -269,27 +269,14 @@ static void wt_status_print_untracked(struct wt_status *s)
static void wt_status_print_verbose(struct wt_status *s)
{
struct rev_info rev;
- int saved_stdout;
-
- fflush(s->fp);
-
- /* Sigh, the entire diff machinery is hardcoded to output to
- * stdout. Do the dup-dance...*/
- saved_stdout = dup(STDOUT_FILENO);
- if (saved_stdout < 0 ||dup2(fileno(s->fp), STDOUT_FILENO) < 0)
- die("couldn't redirect stdout\n");
init_revisions(&rev, NULL);
setup_revisions(0, NULL, &rev, s->reference);
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
rev.diffopt.detect_rename = 1;
+ rev.diffopt.file = s->fp;
+ rev.diffopt.close_file = 0;
run_diff_index(&rev, 1);
-
- fflush(stdout);
-
- if (dup2(saved_stdout, STDOUT_FILENO) < 0)
- die("couldn't restore stdout\n");
- close(saved_stdout);
}
void wt_status_print(struct wt_status *s)