Skip to content
  • Jeff King's avatar
    pager: handle early config · eed27072
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    The pager code is often run early in the git.c startup,
    before we have actually found the repository. When we ask
    git_config() to look for values like core.pager, it doesn't
    know where to find the repo-level config, and will blindly
    examine ".git/config" if it exists. That's why t7006 shows
    that many pager-related features happen to work from the
    top-level of a repository, but not from a subdirectory.
    
    This patch pulls that ".git/config" hack explicitly into the
    pager code. There are two reasons for this:
    
      1. We'd like to clean up the git_config() behavior, as
         looking at ".git/config" when we do not have a
         configured repository is often the wrong thing to do.
         But we'd prefer not to break the pager config any worse
         than it already is.
    
      2. It's one very tiny step on the road to ultimately
         making the pager config work consistently. If we
         eventually get an equivalent of setup_git_directory()
         that _just_ finds the directory and doesn't chdir() or
         set up any global state, we could plug it in here
         (instead of blindly looking at ".git/config").
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    eed27072