Re: [PATCH v2] Simplify handling of setup_git_directory_gently() failure cases.

2019-01-02 Thread Jeff King
On Thu, Dec 27, 2018 at 03:46:10PM -0800, Erin Dahlgren wrote: > > Heh, I should learn to cut and paste better. This should be: > > > > if (!nongit_ok || !*nongit_ok) > > > > (which comes from the current code). > > Yep, but I think we can benefit from De Morgan's law here, where: > > (!nong

Re: [PATCH v2] Simplify handling of setup_git_directory_gently() failure cases.

2018-12-27 Thread Erin Dahlgren
On Thu, Dec 27, 2018 at 8:24 AM Jeff King wrote: > > On Wed, Dec 26, 2018 at 02:22:39PM -0800, Junio C Hamano wrote: > > > >> Side note: One of the secondary goals of my patch was to make it > > >> really obvious that neither the GIT_DIR_HIT_CEILING nor the > > >> GIT_DIR_HIT_MOUNT_POINT case can

Re: [PATCH v2] Simplify handling of setup_git_directory_gently() failure cases.

2018-12-27 Thread Jeff King
On Wed, Dec 26, 2018 at 02:22:39PM -0800, Junio C Hamano wrote: > >> Side note: One of the secondary goals of my patch was to make it > >> really obvious that neither the GIT_DIR_HIT_CEILING nor the > >> GIT_DIR_HIT_MOUNT_POINT case can get us into the block protected by > >> (startup_info->have_r

Re: [PATCH v2] Simplify handling of setup_git_directory_gently() failure cases.

2018-12-26 Thread Junio C Hamano
Jeff King writes: > On Tue, Dec 18, 2018 at 12:54:02PM -0800, Erin Dahlgren wrote: > ... >> GIT_DIR_HIT_MOUNT_POINT. I'm not sure how important of a guarantee it >> is, but we should respect what's documented. > > Yeah, agreed. > > Another benefit of avoiding the early return is that we hit the c

Re: [PATCH v2] Simplify handling of setup_git_directory_gently() failure cases.

2018-12-19 Thread Jeff King
On Tue, Dec 18, 2018 at 12:54:02PM -0800, Erin Dahlgren wrote: > > Might it make sense to make GIT_DIR_HIT_MOUNT_POINT more like > > GIT_DIR_HIT_CEILING currently is, rather than the other way around? > > I.e., something like: > > > > case GIT_DIR_HIT_CEILING: > > if (!nongit_ok) > >

Re: [PATCH v2] Simplify handling of setup_git_directory_gently() failure cases.

2018-12-18 Thread Erin Dahlgren
Hi Peff, On Tue, Dec 18, 2018 at 9:54 AM Jeff King wrote: > > On Sat, Dec 15, 2018 at 05:05:08PM -0800, Erin Dahlgren wrote: > > > setup_git_directory_gently() expects two types of failures to > > discover a git directory (e.g. .git/): > > [...] > > When I read your subject line, I'll admit to ha

Re: [PATCH v2] Simplify handling of setup_git_directory_gently() failure cases.

2018-12-18 Thread Erin Dahlgren
Sorry Johannes for the repeat message, I failed to send to all. On Tue, Dec 18, 2018 at 4:35 AM Johannes Schindelin wrote: > > Hi Erin, > > On Sat, 15 Dec 2018, Erin Dahlgren wrote: > > > diff --git a/setup.c b/setup.c > > index 1be5037..e1a9e17 100644 > > --- a/setup.c > > +++ b/setup.c > > @@ -

Re: [PATCH v2] Simplify handling of setup_git_directory_gently() failure cases.

2018-12-18 Thread Jeff King
On Sat, Dec 15, 2018 at 05:05:08PM -0800, Erin Dahlgren wrote: > setup_git_directory_gently() expects two types of failures to > discover a git directory (e.g. .git/): > [...] When I read your subject line, I'll admit to having a funny feeling in the pit of my stomach. This setup code has histori

Re: [PATCH v2] Simplify handling of setup_git_directory_gently() failure cases.

2018-12-18 Thread Johannes Schindelin
Hi Erin, On Sat, 15 Dec 2018, Erin Dahlgren wrote: > diff --git a/setup.c b/setup.c > index 1be5037..e1a9e17 100644 > --- a/setup.c > +++ b/setup.c > @@ -831,16 +831,6 @@ static const char *setup_bare_git_dir(struct strbuf > *cwd, int offset, > return NULL; > } > > -static const char *s

[PATCH v2] Simplify handling of setup_git_directory_gently() failure cases.

2018-12-15 Thread Erin Dahlgren
setup_git_directory_gently() expects two types of failures to discover a git directory (e.g. .git/): - GIT_DIR_HIT_CEILING: could not find a git directory in any parent directories of the cwd. - GIT_DIR_HIT_MOUNT_POINT: could not find a git directory in any parent directories u