Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
wt-status.c: no need for dup() dance anymore
author
Kristian Høgsberg
<krh@redhat.com>
Mon, 10 Mar 2008 17:58:26 +0000
(13:58 -0400)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 14 Mar 2008 07:42:14 +0000
(
00:42
-0700)
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>
wt-status.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
c0c7773
)
diff --git
a/wt-status.c
b/wt-status.c
index 701d13da7c7b2d3de7ca67fbd663d6e9da813151..b3fd57b79df3513d271c23caf3ab46b3ba405e40 100644
(file)
--- 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;
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;
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);
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)
}
void wt_status_print(struct wt_status *s)