Skip to content
  • Jeff King's avatar
    common-main: stop munging argv[0] path · 6854a8f5
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    Since 650c4492 (common-main: call git_extract_argv0_path(),
    2016-07-01), the argv[0] that is seen in cmd_main() of
    individual programs is always the basename of the
    executable, as common-main strips off the full path. This
    can produce confusing results for git-daemon, which wants to
    re-exec itself.
    
    For instance, if the program was originally run as
    "/usr/lib/git/git-daemon", it will try just re-execing
    "git-daemon", which will find the first instance in $PATH.
    If git's exec-path has not been prepended to $PATH, we may
    find the git-daemon from a different version (or no
    git-daemon at all).
    
    Normally this isn't a problem. Git commands are run as "git
    daemon", the git wrapper puts the exec-path at the front of
    $PATH, and argv[0] is already "daemon" anyway. But running
    git-daemon via its full exec-path, while not really a
    recommended method, did work prior to 650c4492. Let's make
    it work again.
    
    The real goal of 650c4492 was not to munge argv[0], but to
    reliably set ...
    6854a8f5