From 7f4d4746c14f928b7b6cdc2d21e4bbb2a770187f Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Mon, 9 Nov 2015 19:26:29 -0500 Subject: credential-cache: new option to ignore 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 Signed-off-by: Jeff King diff --git a/Documentation/config.txt b/Documentation/config.txt index b4b0194..2d06b11 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1122,6 +1122,9 @@ credential..*:: example.com. See linkgit:gitcredentials[7] for details on how URLs are matched. +credentialCache.ignoreSIGHUP:: + Tell git-credential-cache--daemon to ignore SIGHUP, instead of quitting. + include::diff-config.txt[] difftool..path:: diff --git a/credential-cache--daemon.c b/credential-cache--daemon.c index 82715aa..9365f2c 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] ", 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); -- cgit v0.10.2-6-g49f6