[PATCHv7 4/6] worktree: have a function to check if worktrees are in use

2016-12-08 Thread Stefan Beller
In a later patch we want to move around the the git directory of a submodule. Both submodules as well as worktrees are involved in placing git directories at unusual places, so their functionality may collide. To react appropriately to situations where worktrees in submodules are in use, offer a ne

Re: [PATCHv7 4/6] worktree: have a function to check if worktrees are in use

2016-12-09 Thread Duy Nguyen
On Thu, Dec 08, 2016 at 01:03:27PM -0800, Stefan Beller wrote: > +/* > + * NEEDSWORK: The values in the returned worktrees are broken, e.g. > + * the refs or path resolution is influenced by the current repository. > + */ > +static struct worktree **get_submodule_worktrees(const char *path, unsigne

Re: [PATCHv7 4/6] worktree: have a function to check if worktrees are in use

2016-12-09 Thread Stefan Beller
On Fri, Dec 9, 2016 at 4:00 AM, Duy Nguyen wrote: > int submodule_uses_worktrees(const char *path) > { > struct strbuf path = STRBUF_INIT; > DIR *dir; > struct dirent *d; > int ret = 0; > > strbuf_addf(&path, "%s/worktrees", path); > dir = opendir(p

Re: [PATCHv7 4/6] worktree: have a function to check if worktrees are in use

2016-12-10 Thread Duy Nguyen
On Sat, Dec 10, 2016 at 1:49 AM, Stefan Beller wrote: > On Fri, Dec 9, 2016 at 4:00 AM, Duy Nguyen wrote: > >> int submodule_uses_worktrees(const char *path) >> { >> struct strbuf path = STRBUF_INIT; >> DIR *dir; >> struct dirent *d; >> int ret = 0; >> >> s