File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -473,6 +473,8 @@ static void execv_dashed_external(const char **argv)
473
473
const char * tmp ;
474
474
int status ;
475
475
476
+ if (use_pager == -1 )
477
+ use_pager = check_pager_config (argv [0 ]);
476
478
commit_pager_choice ();
477
479
478
480
strbuf_addf (& cmd , "git-%s" , argv [0 ]);
Original file line number Diff line number Diff line change @@ -450,4 +450,40 @@ test_expect_success TTY 'command-specific pager overridden by environment' '
450
450
test_cmp expect actual
451
451
'
452
452
453
+ test_expect_success ' setup external command' '
454
+ cat >git-external <<-\EOF &&
455
+ #!/bin/sh
456
+ git "$@"
457
+ EOF
458
+ chmod +x git-external
459
+ '
460
+
461
+ test_expect_success TTY ' command-specific pager works for external commands' '
462
+ sane_unset PAGER GIT_PAGER &&
463
+ echo "foo:initial" >expect &&
464
+ >actual &&
465
+ test_config pager.external "sed s/^/foo:/ >actual" &&
466
+ test_terminal git --exec-path="`pwd`" external log --format=%s -1 &&
467
+ test_cmp expect actual
468
+ '
469
+
470
+ test_expect_success TTY ' sub-commands of externals use their own pager' '
471
+ sane_unset PAGER GIT_PAGER &&
472
+ echo "foo:initial" >expect &&
473
+ >actual &&
474
+ test_config pager.log "sed s/^/foo:/ >actual" &&
475
+ test_terminal git --exec-path=. external log --format=%s -1 &&
476
+ test_cmp expect actual
477
+ '
478
+
479
+ test_expect_success TTY ' external command pagers override sub-commands' '
480
+ sane_unset PAGER GIT_PAGER &&
481
+ >expect &&
482
+ >actual &&
483
+ test_config pager.external false &&
484
+ test_config pager.log "sed s/^/log:/ >actual" &&
485
+ test_terminal git --exec-path=. external log --format=%s -1 &&
486
+ test_cmp expect actual
487
+ '
488
+
453
489
test_done
You can’t perform that action at this time.
0 commit comments