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

Function odb_set_temporary_primary_source

odb.c:228–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228struct odb_source *odb_set_temporary_primary_source(struct object_database *odb,
229 const char *dir, int will_destroy)
230{
231 struct odb_source *source;
232
233 /*
234 * Make sure alternates are initialized, or else our entry may be
235 * overwritten when they are.
236 */
237 odb_prepare_alternates(odb);
238
239 /*
240 * Make a new primary odb and link the old primary ODB in as an
241 * alternate
242 */
243 source = odb_source_new(odb, dir, false);
244
245 /*
246 * Disable ref updates while a temporary odb is active, since
247 * the objects in the database may roll back.
248 */
249 odb->repo->disable_ref_updates = true;
250 source->will_destroy = will_destroy;
251 source->next = odb->sources;
252 odb->sources = source;
253 return source->next;
254}
255
256void odb_restore_primary_source(struct object_database *odb,
257 struct odb_source *restore_source,

Callers 1

Calls 2

odb_prepare_alternatesFunction · 0.85
odb_source_newFunction · 0.85

Tested by

no test coverage detected