On Fri, Dec 9, 2016 at 4:00 AM, Duy Nguyen <pclouds@xxxxxxxxx> 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(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?