From dc7fb4f72c2e39ffbb98aee55ad7ea4c3f8e12fc Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 17 May 2024 10:18:44 +0200 Subject: refs: retrieve worktree ref stores via associated repository Similar as with the preceding commit, the worktree ref stores are always looked up via `the_repository`. Also, again, those ref stores are stored in a global map. Refactor the code so that worktrees have a pointer to their repository. Like this, we can move the global map into `struct repository` and stop using `the_repository`. With this change, we can now in theory look up worktree ref stores for repositories other than `the_repository`. In practice, the worktree code will need further changes to look up arbitrary worktrees. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- worktree.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'worktree.h') diff --git a/worktree.h b/worktree.h index f14784a2ff..7cc6d90e66 100644 --- a/worktree.h +++ b/worktree.h @@ -6,6 +6,8 @@ struct strbuf; struct worktree { + /* The repository this worktree belongs to. */ + struct repository *repo; char *path; char *id; char *head_ref; /* NULL if HEAD is broken or detached */ -- cgit v1.3