• J
    grep: use run-command's "dir" option for --open-files-in-pager · 26ecfe3e
    Jeff King 提交于
    Git generally changes directory to the repository root on
    startup.  When running "grep --open-files-in-pager" from a
    subdirectory, we chdir back to the original directory before
    running the pager, so that we can feed the relative
    pathnames to the pager.
    
    We currently do this chdir manually, but we can ask
    run_command to do it for us. This is fewer lines of code,
    and as a bonus, the chdir is limited to the child process,
    which avoids any unexpected surprises for code running after
    the pager (there isn't any currently, but this is
    future-proofing).
    Signed-off-by: NJeff King <peff@peff.net>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    26ecfe3e
grep.c 24.1 KB