Re: git-credential-cache--daemon quits on SIGHUP, can we change it to ignore instead?
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 4, 2015, 18:55 UTC
- Message-ID
- <xmqqpoymrql7.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20151110122501.GA14418@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
>> diff --git a/credential-cache--daemon.c b/credential-cache--daemon.c
>> index eef6fce..6cda9c0 100644
>> --- a/credential-cache--daemon.c
>> +++ b/credential-cache--daemon.c
>> @@ -256,6 +256,9 @@ int main(int argc, const char **argv)
>> OPT_END()
>> };
>>
>> + int ignore_sighup = 0;
>> + git_config_get_bool("credentialcache.ignoresighup", &ignore_sighup);
>> +
>
> Style-wise, I think the declaration should go above the options-list.I was about to merge this to 'master', following your last issue of "What's cooking" report.
I was puzzled that git_config_get_bool() is used here without even checking if we are inside any Git repository and wondered if it was correct. I'd imagine this is not a problem, as this process is spawned by "credential-cache" that was spawned by somebody (either push or fetch) who has read $GIT_DIR/config for credential.helper to determine that credential-cache needs to be used.
Show 15 quoted lines
>> @@ -264,6 +267,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); >> + > > This part looks obviously correct. :) > > I don't think there's any need to use sigchain_push here (we have no > intention of ever popping it). > > -Peff