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

Function update_modes

builtin/sparse-checkout.c:418–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418static int update_modes(struct repository *repo, int *cone_mode, int *sparse_index)
419{
420 int mode, record_mode;
421 struct repo_config_values *cfg = repo_config_values(the_repository);
422
423 /* Determine if we need to record the mode; ensure sparse checkout on */
424 record_mode = (*cone_mode != -1) || !cfg->apply_sparse_checkout;
425
426 mode = update_cone_mode(cone_mode);
427 if (record_mode && set_config(repo, mode))
428 return 1;
429
430 /* Set sparse-index/non-sparse-index mode if specified */
431 if (*sparse_index >= 0) {
432 if (set_sparse_index_config(repo, *sparse_index) < 0)
433 die(_("failed to modify sparse-index config"));
434
435 /* force an index rewrite */
436 repo_read_index(repo);
437 repo->index->updated_workdir = 1;
438
439 if (!*sparse_index)
440 ensure_full_index(repo->index);
441 }
442
443 return 0;
444}
445
446static char const * const builtin_sparse_checkout_init_usage[] = {
447 "git sparse-checkout init [--cone] [--[no-]sparse-index]",

Callers 3

sparse_checkout_initFunction · 0.85
sparse_checkout_setFunction · 0.85
sparse_checkout_reapplyFunction · 0.85

Calls 7

update_cone_modeFunction · 0.85
set_sparse_index_configFunction · 0.85
repo_read_indexFunction · 0.85
ensure_full_indexFunction · 0.85
repo_config_valuesClass · 0.70
set_configFunction · 0.70
dieFunction · 0.50

Tested by

no test coverage detected