@@ -436,10 +436,9 @@ static void exec_viewer(const char *name, const char *page)
436
436
warning (_ ("'%s': unknown man viewer." ), name );
437
437
}
438
438
439
- static void show_man_page (const char * git_cmd )
439
+ static void show_man_page (const char * page )
440
440
{
441
441
struct man_viewer_list * viewer ;
442
- const char * page = cmd_to_page (git_cmd );
443
442
const char * fallback = getenv ("GIT_MAN_VIEWER" );
444
443
445
444
setup_man_path ();
@@ -453,9 +452,8 @@ static void show_man_page(const char *git_cmd)
453
452
die (_ ("no man viewer handled the request" ));
454
453
}
455
454
456
- static void show_info_page (const char * git_cmd )
455
+ static void show_info_page (const char * page )
457
456
{
458
- const char * page = cmd_to_page (git_cmd );
459
457
setenv ("INFOPATH" , system_path (GIT_INFO_PATH ), 1 );
460
458
execlp ("info" , "info" , "gitman" , page , (char * )NULL );
461
459
die (_ ("no info viewer handled the request" ));
@@ -486,9 +484,8 @@ static void open_html(const char *path)
486
484
execl_git_cmd ("web--browse" , "-c" , "help.browser" , path , (char * )NULL );
487
485
}
488
486
489
- static void show_html_page (const char * git_cmd )
487
+ static void show_html_page (const char * page )
490
488
{
491
- const char * page = cmd_to_page (git_cmd );
492
489
struct strbuf page_path ; /* it leaks but we exec bellow */
493
490
494
491
get_html_page_path (& page_path , page );
@@ -548,6 +545,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
548
545
{
549
546
int nongit ;
550
547
enum help_format parsed_help_format ;
548
+ const char * page ;
551
549
552
550
argc = parse_options (argc , argv , prefix , builtin_help_options ,
553
551
builtin_help_usage , 0 );
@@ -606,16 +604,17 @@ int cmd_help(int argc, const char **argv, const char *prefix)
606
604
607
605
argv [0 ] = check_git_cmd (argv [0 ]);
608
606
607
+ page = cmd_to_page (argv [0 ]);
609
608
switch (help_format ) {
610
609
case HELP_FORMAT_NONE :
611
610
case HELP_FORMAT_MAN :
612
- show_man_page (argv [ 0 ] );
611
+ show_man_page (page );
613
612
break ;
614
613
case HELP_FORMAT_INFO :
615
- show_info_page (argv [ 0 ] );
614
+ show_info_page (page );
616
615
break ;
617
616
case HELP_FORMAT_WEB :
618
- show_html_page (argv [ 0 ] );
617
+ show_html_page (page );
619
618
break ;
620
619
}
621
620
0 commit comments