Download raw body.
got_worktree_open: always recognize locked worktree
Let's say I have a worktree that is locked by some other command. $ got log got: worktree already locked $ tog tog: no git repository found Wait, what? That problem was introduced by df6221c7 use a separate .cvg meta data directory for cvg(1) work trees In got_worktree_open(): + if (meta_dir == NULL) { + for (i = 0; i < nitems(meta_dirs); i++) { + err = open_worktree(worktree, worktree_path, + meta_dirs[i]); + if (err == NULL) + break; + } That ignores the GOT_ERR_WORKTREE_BUSY error from .got, proceeds to try .cvg, and reports the error resulting from a missing .cvg. It doesn't affect got(1), because that always uses the .got directory. Does this look like a sensible fix? diff /home/naddy/got commit - 2cafc7864a7ffed14fede7310877bc28c6e7ef8f path + /home/naddy/got blob - c3846b45dec95fcd923225f11b5f013d97fc39c0 file + lib/worktree_open.c --- lib/worktree_open.c +++ lib/worktree_open.c @@ -286,7 +286,8 @@ got_worktree_open(struct got_worktree **worktree, cons for (i = 0; i < nitems(meta_dirs); i++) { err = open_worktree(worktree, worktree_path, meta_dirs[i]); - if (err == NULL) + if (err == NULL || + err->code == GOT_ERR_WORKTREE_BUSY) break; } } else -- Christian "naddy" Weisgerber naddy@mips.inka.de
got_worktree_open: always recognize locked worktree