git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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?

Previous: Duy NguyenNext: Duy Nguyen
Message 8 of 10 in “[PATCHv7 0/6] submodule absorbgitdirs”
  1. Stefan BellerDec 8, 2016
  2. 1/6 submodule: use absolute path for computing relative path connectingStefan Beller, Dec 8, 2016
  3. 2/6 submodule helper: support super prefixStefan Beller, Dec 8, 2016
  4. 5/6 move connect_work_tree_and_git_dir to dir.hStefan Beller, Dec 8, 2016
  5. 3/6 test-lib-functions.sh: teach test_commit -C <dir>Stefan Beller, Dec 8, 2016
  6. 4/6 worktree: have a function to check if worktrees are in useStefan Beller, Dec 8, 2016
  7. Duy NguyenDec 9, 2016
  8. Stefan BellerDec 9, 2016
  9. Duy NguyenDec 10, 2016
  10. 6/6 submodule: add absorb-git-dir functionStefan Beller, Dec 8, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.