Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx> writes: > The old code was: > > if (use_global_config) { > char *home = getenv("HOME"); > if (home) { > char *user_config = xstrdup(mkpath("%s/.gitconfig", home)); > given_config_file = user_config; > } else { > die("$HOME not set"); > } > } I think the above is a good illustration of the crux of the issue, as the natural way to introduce XDG that is used when the one at $HOME/.gitconfig is not there seems at least to me to do this: if (use_global_config) { if (is $HOME/.gitconfig usable?) { use it; } else if (is $XDG/git/config usable?) { use $XDG location; } else { die("Neither $XDG or $HOME is usable"); } } In other words, we are not trying to say "You do not have $HOME -- there is something wrong, so we will give up" in this codepath. We were saying "Can we use _the_ place we place personal config? It is an error if we cannot find it, so we die." and the above says "Can we use this place? Can we use that place? If no place is found to be usable, we die." And the intent of the "NULL-buggy" version seems to want the same "If we cannot use home/.gitconfig but xdg_config one is usable, use xdg one" semantics to me. if (access(user_config, R_OK) && !access(xdg_config, R_OK)) given_config_file = xdg_config; else if (user_config) given_config_file = user_config; -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html