From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff King Subject: Re: git-credential-cache--daemon quits on SIGHUP, can we change it to ignore instead? Date: Fri, 4 Dec 2015 14:06:59 -0500 Message-ID: <20151204190658.GA16692@sigill.intra.peff.net> References: <20151030001000.GA2123@sigill.intra.peff.net> <20151030005057.GA23251@sigill.intra.peff.net> <20151030210849.GA7149@sigill.intra.peff.net> <20151109155342.GB27224@sigill.intra.peff.net> <20151110122501.GA14418@sigill.intra.peff.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: Noam Postavsky , git@vger.kernel.org To: Junio C Hamano X-From: git-owner@vger.kernel.org Fri Dec 04 20:07:11 2015 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a4vhG-0002Lp-3e for gcvg-git-2@plane.gmane.org; Fri, 04 Dec 2015 20:07:10 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754953AbbLDTHE (ORCPT ); Fri, 4 Dec 2015 14:07:04 -0500 Received: from cloud.peff.net ([50.56.180.127]:37439 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753472AbbLDTHD (ORCPT ); Fri, 4 Dec 2015 14:07:03 -0500 Received: (qmail 28332 invoked by uid 102); 4 Dec 2015 19:07:02 -0000 Received: from Unknown (HELO peff.net) (10.0.1.1) by cloud.peff.net (qpsmtpd/0.84) with SMTP; Fri, 04 Dec 2015 13:07:02 -0600 Received: (qmail 26519 invoked by uid 107); 4 Dec 2015 19:07:04 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) by peff.net (qpsmtpd/0.84) with SMTP; Fri, 04 Dec 2015 14:07:04 -0500 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Fri, 04 Dec 2015 14:06:59 -0500 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Fri, Dec 04, 2015 at 10:55:32AM -0800, Junio C Hamano wrote: > >> + 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. That does not have to be the case; I imagine most people would put credential.helper in their ~/.gitconfig. But I'm not sure I understand how that is relevant. The config subsystem should work just fine whether we are in a repository or not (and if not, return results only from system and user-wide config). This probably _does_ trigger setup_git_env() when it was not otherwise called, and it will back to looking at ".git/config" for the repo-level config. That may fail to find the file if we are in a bare repository, or a subdirectory of the working tree. IOW, I suspect this: git init --bare foo.git cd foo.git git config credential.helper cache git config credentialcache.ignoreSIGHUP true ;# goes into local config git fetch https://example.com/foo.git may fail to respect the ignoreSIGHUP option. I guess the solution would be to setup_git_director_gently() in the daemon process. -Peff