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

Re: Worktree silently deleted on git fetch/gc/log

From
ДПДилян Палаузов <dilyan.palauzov@aegee.org>
Date
Mar 2, 2018, 11:34 UTC
Message-ID
<b34d74fa-f4c7-fb4a-49df-cd7ebd996d95@aegee.org>
In-Reply-To
<CACsJy8BUKCG-yiYX3ouMVa44iEo0swHpTkhW3ho_T0PCP81DSw@mail.gmail.com>
Hello Duy,
thanks for your answer.
Your assumption is correct: when renaming the directory apparently I have not adjusted /git/A/.git/worktrees/B/gitdir to the new location.
I fixed the situation by renaming /git/B to /git/B.bak, creating a new worktree pointing to /git/B (with branch g), then deleting /git/B and moving /git/B.bak to /git/B .
Consider adjusting the documentation as suggested below, possibly using a different wording.
Regards
   Дилян
On 03/02/18 00:56, Duy Nguyen wrote:
Show 17 quoted lines
> On Fri, Mar 2, 2018 at 3:14 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>> As far as I know, there isn't any code in Git which would
>> automatically remove the .git/worktrees/B directory, so it's not clear
>> how that happened.
> 
> "git worktree prune" does, which is called by "git gc" and that was
> actually executed from the command output in the original mail.
> 
> Дилян Палаузов did you move /git/B away manually? For example, you
> originally created "B" with
> 
> git worktree add /somewhere/B g
> 
> then you do this at some point
> 
> mv /somewhere/B /git/B
> 

Signed-off-by Дилян Палаузов <git-dpa@aegee.org> ---

diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 571b5a7..33655c4 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -15,8 +15,8 @@ DESCRIPTION
  -----------
  Runs a number of housekeeping tasks within the current repository,
  such as compressing file revisions (to reduce disk space and increase
-performance) and removing unreachable objects which may have been
-created from prior invocations of 'git add'.
+performance), removing unreachable objects, which may have been
+created from prior invocations of 'git add', and calling 'git worktree prune'.
  
  Users are encouraged to run this task on a regular basis within
  each repository to maintain good disk space utilization and good
diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt
index 5ac3f68..4b0d32f 100644
--- a/Documentation/git-worktree.txt
+++ b/Documentation/git-worktree.txt
@@ -82,7 +82,7 @@ with `--reason`.
  
  prune::
  
-Prune working tree information in $GIT_DIR/worktrees.
+Prune working tree information in $GIT_DIR/worktrees.  Called implicitly by 'git gc'.
  
  unlock::
  
--
2.10.0.298.gc59cecb
Previous: Duy NguyenNext: Eric Sunshine
Message 6 of 10 in “Worktree silently deleted on git fetch/gc/log”
  1. Дилян ПалаузовFeb 28, 2018
  2. Eric SunshineMar 1, 2018
  3. Дилян ПалаузовMar 1, 2018
  4. Eric SunshineMar 1, 2018
  5. Duy NguyenMar 1, 2018
  6. Дилян ПалаузовMar 2, 2018
  7. Eric SunshineMar 2, 2018
  8. Duy NguyenMar 2, 2018
  9. Eric SunshineMar 3, 2018
  10. Duy NguyenMar 7, 2018

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.