MCPcopy Index your code
hub / github.com/git/git / write_shared_index

Function write_shared_index

read-cache.c:3241–3277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3239}
3240
3241static int write_shared_index(struct index_state *istate,
3242 struct tempfile **temp, unsigned flags)
3243{
3244 struct split_index *si = istate->split_index;
3245 int ret, was_full = !istate->sparse_index;
3246 char *path;
3247
3248 move_cache_to_base_index(istate);
3249 convert_to_sparse(istate, 0);
3250
3251 trace2_region_enter_printf("index", "shared/do_write_index",
3252 the_repository, "%s", get_tempfile_path(*temp));
3253 ret = do_write_index(si->base, *temp, WRITE_NO_EXTENSION, flags);
3254 trace2_region_leave_printf("index", "shared/do_write_index",
3255 the_repository, "%s", get_tempfile_path(*temp));
3256
3257 if (was_full)
3258 ensure_full_index(istate);
3259
3260 if (ret)
3261 return ret;
3262 ret = adjust_shared_perm(the_repository, get_tempfile_path(*temp));
3263 if (ret) {
3264 error(_("cannot fix permission bits on '%s'"), get_tempfile_path(*temp));
3265 return ret;
3266 }
3267
3268 path = repo_git_path(the_repository, "sharedindex.%s", oid_to_hex(&si->base->oid));
3269 ret = rename_tempfile(temp, path);
3270 if (!ret) {
3271 oidcpy(&si->base_oid, &si->base->oid);
3272 clean_shared_index_files(oid_to_hex(&si->base->oid));
3273 }
3274
3275 free(path);
3276 return ret;
3277}
3278
3279static const int default_max_percent_split_change = 20;
3280

Callers 1

write_locked_indexFunction · 0.85

Calls 12

move_cache_to_base_indexFunction · 0.85
convert_to_sparseFunction · 0.85
get_tempfile_pathFunction · 0.85
do_write_indexFunction · 0.85
ensure_full_indexFunction · 0.85
adjust_shared_permFunction · 0.85
errorFunction · 0.85
repo_git_pathFunction · 0.85
oid_to_hexFunction · 0.85
rename_tempfileFunction · 0.85
oidcpyFunction · 0.85
clean_shared_index_filesFunction · 0.85

Tested by

no test coverage detected