Skip to content

Commit

Permalink
Merge branch 'np/credential-cache-sighup'
Browse files Browse the repository at this point in the history
Workaround for using credential-cache with emacs.

* np/credential-cache-sighup:
  credential-cache: new option to ignore sighup
  • Loading branch information
Junio C Hamano committed Dec 4, 2015
2 parents 2d80807 + 7f4d474 commit 3a5b6ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,9 @@ credential.<url>.*::
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.<tool>.path::
Expand Down
7 changes: 7 additions & 0 deletions credential-cache--daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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];

Expand All @@ -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);

Expand Down

0 comments on commit 3a5b6ee

Please sign in to comment.