summaryrefslogtreecommitdiff
path: root/credential-cache--daemon.c
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@users.sourceforge.net>2015-11-09 19:26:29 -0500
committerJeff King <peff@peff.net>2015-11-20 08:02:07 -0500
commit7f4d4746c14f928b7b6cdc2d21e4bbb2a770187f (patch)
treedd31683d38c23910fa9629084785dad1539104a6 /credential-cache--daemon.c
parent0c83680e9c047170614fb08ef222ea4f460e514d (diff)
downloadgit-7f4d4746c14f928b7b6cdc2d21e4bbb2a770187f.tar.gz
credential-cache: new option to ignore sighupnp/credential-cache-sighup
Introduce new option "credentialCache.ignoreSIGHUP" which stops git-credential-cache--daemon from quitting on SIGHUP. This is useful when "git push" is started from Emacs, because all child processes (including the daemon) will receive a SIGHUP when "git push" exits. Signed-off-by: Noam Postavsky <npostavs@users.sourceforge.net> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'credential-cache--daemon.c')
-rw-r--r--credential-cache--daemon.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/credential-cache--daemon.c b/credential-cache--daemon.c
index 82715aa8b8..9365f2ce5c 100644
--- a/credential-cache--daemon.c
+++ b/credential-cache--daemon.c
@@ -244,6 +244,7 @@ static void check_socket_directory(const char *path)
int main(int argc, const char **argv)
{
const char *socket_path;
+ int ignore_sighup = 0;
static const char *usage[] = {
"git-credential-cache--daemon [opts] <socket_path>",
NULL
@@ -255,6 +256,8 @@ int main(int argc, const char **argv)
OPT_END()
};
+ git_config_get_bool("credentialcache.ignoresighup", &ignore_sighup);
+
argc = parse_options(argc, argv, NULL, options, usage, 0);
socket_path = argv[0];
@@ -263,6 +266,10 @@ int main(int argc, const char **argv)
check_socket_directory(socket_path);
register_tempfile(&socket_file, socket_path);
+
+ if (ignore_sighup)
+ signal(SIGHUP, SIG_IGN);
+
serve_cache(socket_path, debug);
delete_tempfile(&socket_file);