MCPcopy Create free account
hub / github.com/git/git / backend_for_worktree

Function backend_for_worktree

refs/reftable-backend.c:175–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175static int backend_for_worktree(struct reftable_backend **out,
176 struct reftable_ref_store *store,
177 const char *worktree_name)
178{
179 struct strbuf worktree_dir = STRBUF_INIT;
180 int ret;
181
182 *out = strmap_get(&store->worktree_backends, worktree_name);
183 if (*out) {
184 ret = 0;
185 goto out;
186 }
187
188 strbuf_addf(&worktree_dir, "%s/worktrees/%s/reftable",
189 store->base.repo->commondir, worktree_name);
190
191 CALLOC_ARRAY(*out, 1);
192 store->err = ret = reftable_backend_init(*out, worktree_dir.buf,
193 &store->write_options);
194 if (ret < 0) {
195 free(*out);
196 goto out;
197 }
198
199 strmap_put(&store->worktree_backends, worktree_name, *out);
200
201out:
202 strbuf_release(&worktree_dir);
203 return ret;
204}
205
206/*
207 * Some refs are global to the repository (refs/heads/{*}), while others are

Callers 2

backend_forFunction · 0.85
reftable_be_fsckFunction · 0.85

Calls 5

strmap_getFunction · 0.85
strbuf_addfFunction · 0.85
reftable_backend_initFunction · 0.85
strmap_putFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected