Skip to content

Commit 8ec6c8d

Browse files
peffgitster
authored andcommitted
credential-cache: report more daemon connection errors
Originally, this code remained relatively silent when we failed to connect to the cache. The idea was that it was simply a cache, and we didn't want to bother the user with temporary failures (the worst case is that we would simply ask their password again). However, if you have a configuration failure or other problem, it is helpful for the daemon to report those problems. Git will happily ignore the failed error code, but the extra information to stderr can help the user diagnose the problem. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1eb10f4 commit 8ec6c8d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

credential-cache.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ static void do_cache(const char *socket, const char *action, int timeout,
7171
die_errno("unable to relay credential");
7272
}
7373

74-
if (send_request(socket, &buf) < 0 && (flags & FLAG_SPAWN)) {
75-
spawn_daemon(socket);
76-
if (send_request(socket, &buf) < 0)
74+
if (send_request(socket, &buf) < 0) {
75+
if (errno != ENOENT)
7776
die_errno("unable to connect to cache daemon");
77+
if (flags & FLAG_SPAWN) {
78+
spawn_daemon(socket);
79+
if (send_request(socket, &buf) < 0)
80+
die_errno("unable to connect to cache daemon");
81+
}
7882
}
7983
strbuf_release(&buf);
8084
}

0 commit comments

Comments
 (0)