Re: [PATCH] worktree: update is_bare heuristics

2019-04-19 Thread Duy Nguyen
On Fri, Apr 19, 2019 at 1:30 AM Jonathan Tan wrote: > > > You actually didn't spell out the problem with "git branch -D", or at > > least the consequence (i.e. the submodule branch is deleted even if > > it's checked out). > > Thanks - I'll do that in the commit message. Another minor nit (becaus

Re: [PATCH] worktree: update is_bare heuristics

2019-04-18 Thread Duy Nguyen
On Fri, Apr 19, 2019 at 1:42 AM Jeff King wrote: > > On Thu, Apr 18, 2019 at 11:30:00AM -0700, Jonathan Tan wrote: > > > > > strbuf_add_absolute_path(&worktree_path, get_git_common_dir()); > > > > - is_bare = !strbuf_strip_suffix(&worktree_path, "/.git"); > > > > - if (is_bare)

Re: [PATCH] worktree: update is_bare heuristics

2019-04-18 Thread Jonathan Tan
> > > - Teach get_main_worktree() to use is_bare_repository() instead, > > >introduced in 7d1864ce67 ("Introduce is_bare_repository() and > > >core.bare configuration variable", 2007-01-07) and updated in > > >e90fdc39b6 ("Clean up work-tree handling", 2007-08-01). This solves > > >

Re: [PATCH] worktree: update is_bare heuristics

2019-04-18 Thread Jeff King
On Thu, Apr 18, 2019 at 11:30:00AM -0700, Jonathan Tan wrote: > > > strbuf_add_absolute_path(&worktree_path, get_git_common_dir()); > > > - is_bare = !strbuf_strip_suffix(&worktree_path, "/.git"); > > > - if (is_bare) > > > + if (!strbuf_strip_suffix(&worktree_path, "/.gi

Re: [PATCH] worktree: update is_bare heuristics

2019-04-18 Thread Jonathan Tan
> You actually didn't spell out the problem with "git branch -D", or at > least the consequence (i.e. the submodule branch is deleted even if > it's checked out). Thanks - I'll do that in the commit message. > > strbuf_add_absolute_path(&worktree_path, get_git_common_dir()); > > - i

Re: [PATCH] worktree: update is_bare heuristics

2019-04-18 Thread Duy Nguyen
On Thu, Apr 18, 2019 at 4:22 AM Jonathan Tan wrote: > > When "git branch -D " is run, Git usually first checks if that > branch is currently checked out. But this check is not performed if the > Git directory of that repository is not at "/.git", which is the > case if that repository is a submodu

Re: [PATCH] worktree: update is_bare heuristics

2019-04-18 Thread Johannes Schindelin
Hi, On Thu, 18 Apr 2019, Junio C Hamano wrote: > Jonathan Tan writes: > > > When "git branch -D " is run, Git usually first checks if that > > branch is currently checked out. But this check is not performed if the > > Git directory of that repository is not at "/.git", which is the > > case if

Re: [PATCH] worktree: update is_bare heuristics

2019-04-17 Thread Junio C Hamano
Jonathan Tan writes: [jc: pinging the current area expert for the multiple worktree setup for sanity checking] > When "git branch -D " is run, Git usually first checks if that > branch is currently checked out. But this check is not performed if the > Git directory of that repository is not at "

[PATCH] worktree: update is_bare heuristics

2019-04-17 Thread Jonathan Tan
When "git branch -D " is run, Git usually first checks if that branch is currently checked out. But this check is not performed if the Git directory of that repository is not at "/.git", which is the case if that repository is a submodule that has its Git directory stored as "super/.git/modules/",