summaryrefslogtreecommitdiff
path: root/credential-cache--daemon.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-12-04 11:19:11 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-12-04 11:19:11 -0800
commit3a5b6eeceb8ea149ec8c0139f64683942e62722b (patch)
tree22d3931ab246e836b6d7bb940c31110e1b0733ce /credential-cache--daemon.c
parentMerge branch 'rs/parseopt-short-help' (diff)
parentcredential-cache: new option to ignore sighup (diff)
downloadtgif-3a5b6eeceb8ea149ec8c0139f64683942e62722b.tar.xz
Merge branch 'np/credential-cache-sighup'
Workaround for using credential-cache with emacs. * np/credential-cache-sighup: credential-cache: new option to ignore sighup
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);