File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -1438,6 +1438,7 @@ extern const char *ident_default_name(void);
1438
1438
extern const char * ident_default_email (void );
1439
1439
extern const char * git_editor (void );
1440
1440
extern const char * git_pager (int stdout_is_tty );
1441
+ extern int is_terminal_dumb (void );
1441
1442
extern int git_ident_config (const char * , const char * , void * );
1442
1443
extern void reset_ident_date (void );
1443
1444
Original file line number Diff line number Diff line change @@ -329,8 +329,7 @@ static int check_auto_color(void)
329
329
if (color_stdout_is_tty < 0 )
330
330
color_stdout_is_tty = isatty (1 );
331
331
if (color_stdout_is_tty || (pager_in_use () && pager_use_color )) {
332
- char * term = getenv ("TERM" );
333
- if (term && strcmp (term , "dumb" ))
332
+ if (!is_terminal_dumb ())
334
333
return 1 ;
335
334
}
336
335
return 0 ;
Original file line number Diff line number Diff line change 7
7
#define DEFAULT_EDITOR "vi"
8
8
#endif
9
9
10
+ int is_terminal_dumb (void )
11
+ {
12
+ const char * terminal = getenv ("TERM" );
13
+ return !terminal || !strcmp (terminal , "dumb" );
14
+ }
15
+
10
16
const char * git_editor (void )
11
17
{
12
18
const char * editor = getenv ("GIT_EDITOR" );
13
- const char * terminal = getenv ("TERM" );
14
- int terminal_is_dumb = !terminal || !strcmp (terminal , "dumb" );
19
+ int terminal_is_dumb = is_terminal_dumb ();
15
20
16
21
if (!editor && editor_program )
17
22
editor = editor_program ;
Original file line number Diff line number Diff line change 20
20
21
21
int recv_sideband (const char * me , int in_stream , int out )
22
22
{
23
- const char * term , * suffix ;
23
+ const char * suffix ;
24
24
char buf [LARGE_PACKET_MAX + 1 ];
25
25
struct strbuf outbuf = STRBUF_INIT ;
26
26
int retval = 0 ;
27
27
28
- term = getenv ("TERM" );
29
- if (isatty (2 ) && term && strcmp (term , "dumb" ))
28
+ if (isatty (2 ) && !is_terminal_dumb ())
30
29
suffix = ANSI_SUFFIX ;
31
30
else
32
31
suffix = DUMB_SUFFIX ;
You can’t perform that action at this time.
0 commit comments