Skip to content
  • Johannes Schindelin's avatar
    alias: use the early config machinery to expand aliases · a9bcf658
    Johannes Schindelin authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Instead of discovering the .git/ directory, reading the config and then
    trying to painstakingly reset all the global state if we did not find a
    matching alias, let's use the early config machinery instead.
    
    It may look like unnecessary work to discover the .git/ directory in the
    early config machinery and then call setup_git_directory_gently() in the
    case of a shell alias, repeating the very same discovery *again*.
    However, we have to do this as the early config machinery takes pains
    *not* to touch any global state, while shell aliases expect a possibly
    changed working directory and at least the GIT_PREFIX and GIT_DIR
    variables to be set.
    
    This change also fixes a known issue where Git tried to read the pager
    config from an incorrect path in a subdirectory of a Git worktree if an
    alias expanded to a shell command.
    
    Signed-off-by: default avatarJohannes Schindelin <johannes.schindelin@gmx.de>
    Reviewed-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    a9bcf658