Skip to content

Commit e3f43ce

Browse files
peffgitster
authored andcommitted
usage.c: drop set_error_handle()
The set_error_handle() function was introduced by 3b331e9 (vreportf: report to arbitrary filehandles, 2015-08-11) so that run-command could send post-fork, pre-exec errors to the parent's original stderr. That use went away in 79319b1 (run-command: eliminate calls to error handling functions in child, 2017-04-19), which pushes all of the error reporting to the parent. This leaves no callers of set_error_handle(). As we're not likely to add any new ones, let's drop it. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Brandon Williams <bmwill@google.com> Reviewed-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9402831 commit e3f43ce

2 files changed

Lines changed: 1 addition & 10 deletions

File tree

git-compat-util.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,6 @@ extern void (*get_error_routine(void))(const char *err, va_list params);
445445
extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
446446
extern void (*get_warn_routine(void))(const char *warn, va_list params);
447447
extern void set_die_is_recursing_routine(int (*routine)(void));
448-
extern void set_error_handle(FILE *);
449448

450449
extern int starts_with(const char *str, const char *prefix);
451450

usage.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,17 @@
66
#include "git-compat-util.h"
77
#include "cache.h"
88

9-
static FILE *error_handle;
10-
119
void vreportf(const char *prefix, const char *err, va_list params)
1210
{
1311
char msg[4096];
14-
FILE *fh = error_handle ? error_handle : stderr;
1512
char *p;
1613

1714
vsnprintf(msg, sizeof(msg), err, params);
1815
for (p = msg; *p; p++) {
1916
if (iscntrl(*p) && *p != '\t' && *p != '\n')
2017
*p = '?';
2118
}
22-
fprintf(fh, "%s%s\n", prefix, msg);
19+
fprintf(stderr, "%s%s\n", prefix, msg);
2320
}
2421

2522
static NORETURN void usage_builtin(const char *err, va_list params)
@@ -88,11 +85,6 @@ void set_die_is_recursing_routine(int (*routine)(void))
8885
die_is_recursing = routine;
8986
}
9087

91-
void set_error_handle(FILE *fh)
92-
{
93-
error_handle = fh;
94-
}
95-
9688
void NORETURN usagef(const char *err, ...)
9789
{
9890
va_list params;

0 commit comments

Comments
 (0)