Skip to content

Commit 3a5b6ee

Browse files
committed
Merge branch 'np/credential-cache-sighup'
Workaround for using credential-cache with emacs. * np/credential-cache-sighup: credential-cache: new option to ignore sighup
2 parents 2d80807 + 7f4d474 commit 3a5b6ee

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Documentation/config.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,9 @@ credential.<url>.*::
11221122
example.com. See linkgit:gitcredentials[7] for details on how URLs are
11231123
matched.
11241124

1125+
credentialCache.ignoreSIGHUP::
1126+
Tell git-credential-cache--daemon to ignore SIGHUP, instead of quitting.
1127+
11251128
include::diff-config.txt[]
11261129

11271130
difftool.<tool>.path::

credential-cache--daemon.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ static void check_socket_directory(const char *path)
244244
int main(int argc, const char **argv)
245245
{
246246
const char *socket_path;
247+
int ignore_sighup = 0;
247248
static const char *usage[] = {
248249
"git-credential-cache--daemon [opts] <socket_path>",
249250
NULL
@@ -255,6 +256,8 @@ int main(int argc, const char **argv)
255256
OPT_END()
256257
};
257258

259+
git_config_get_bool("credentialcache.ignoresighup", &ignore_sighup);
260+
258261
argc = parse_options(argc, argv, NULL, options, usage, 0);
259262
socket_path = argv[0];
260263

@@ -263,6 +266,10 @@ int main(int argc, const char **argv)
263266

264267
check_socket_directory(socket_path);
265268
register_tempfile(&socket_file, socket_path);
269+
270+
if (ignore_sighup)
271+
signal(SIGHUP, SIG_IGN);
272+
266273
serve_cache(socket_path, debug);
267274
delete_tempfile(&socket_file);
268275

0 commit comments

Comments
 (0)