• Jeff King's avatar
    setup_git_env(): introduce git_path_from_env() helper · cb6c38d5
    Jeff King authored
    "Check the value of an environment and fall back to a known path
    inside $GIT_DIR" is repeated a few times to determine the location
    of the data store, the index and the graft file, but the return
    value of getenv is not guaranteed to survive across further
    invocations of setenv or even getenv.
    
    Make sure to xstrdup() the value we receive from getenv(3), and
    encapsulate the pattern into a helper function.
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    cb6c38d5
environment.c 7.49 KB