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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jan 9, 2012 at 23:57 UTC
8ec6c8d79567a71ca3c6f1ec73eb453d371b1ade
1 file changed
+7
-3
credential-cache.c
+7
-3
@@ -71,10 +71,14 @@ static void do_cache(const char *socket, const char *action, int timeout,
71
die_errno("unable to relay credential");
72
}
73
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)
76
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
+ }
82
}
83
strbuf_release(&buf);
84
}