Re: [PATCHv7 4/6] worktree: have a function to check if worktrees are in use
- From
Stefan Beller <sbeller@google.com>
- Date
- Dec 9, 2016, 18:49 UTC
- Message-ID
- <CAGZ79kaV4FYZEbRWQxKBHJg1jVzOkte1QxLZgu75=Jja_BMRGQ@mail.gmail.com>
- In-Reply-To
- <20161209120006.GA6609@ash>
On Fri, Dec 9, 2016 at 4:00 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 13 quoted lines
> 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(path.buf);
> strbuf_release(&path);
>
> if (!dir)
> return 0;The submodule may be one of the linked worktrees, which would be caught if we use the code as I sent it out?
If this is one of the linked worktrees, we'd rather check if a file "commondir" or "gitdir" exists?
I ask that because I would not know how to relocate such a linked worktree gitdir?