On Mon, Mar 13, 2017 at 11:09:11AM -0700, Junio C Hamano wrote: > > + if (home_socket) > > + if (file_exists(home_socket)) > > + return home_socket; > > + else > > + free(home_socket); > > + > > + return xdg_cache_home("credential/socket"); > > +} > > I somehow feel that the order of precedence should be the other way > around, though. > > If somebody really wants to use the xdg location and has a socket > already there, using that existing socket would be the right thing > to do. However, when neither ~/.git-credential-cache/socket nor > ~/.cache/git/socket exists, why should we prefer the latter over the > former? How would they get a socket in the xdg location if we never create one? I think the point of this commit is that we should generally prefer the xdg locations to ones that were simply made up by Git. As an aside, I also wondered if stale socket files might cause us to keep picking the "old" location forever. But it looks like credential-cache--daemon does use a tempfile handler to make sure it cleans up the socket afterwards (and we are checking for the actual socket, not just the presence of the outer directory, which is good). -Peff