t/README: add missing value for GIT_TEST_DEFAULT_REF_FORMAT
[git/gitster.git] / sparse-index.h
blob727034be7ca917eff9d90ee564ba22c5754a6809
1 #ifndef SPARSE_INDEX_H__
2 #define SPARSE_INDEX_H__
4 /*
5 * If performing an operation where the index is supposed to expand to a
6 * full index, then disable the advice message by setting this global to
7 * zero.
8 */
9 extern int give_advice_on_expansion;
11 struct index_state;
12 #define SPARSE_INDEX_MEMORY_ONLY (1 << 0)
13 int is_sparse_index_allowed(struct index_state *istate, int flags);
14 int convert_to_sparse(struct index_state *istate, int flags);
15 void ensure_correct_sparsity(struct index_state *istate);
16 void clear_skip_worktree_from_present_files(struct index_state *istate);
19 * Some places in the codebase expect to search for a specific path.
20 * This path might be outside of the sparse-checkout definition, in
21 * which case a sparse-index may not contain a path for that index.
23 * Given an index and a path, check to see if a leading directory for
24 * 'path' exists in the index as a sparse directory. In that case,
25 * expand that sparse directory to a full range of cache entries and
26 * populate the index accordingly.
28 void expand_to_path(struct index_state *istate,
29 const char *path, size_t pathlen, int icase);
31 struct repository;
32 int set_sparse_index_config(struct repository *repo, int enable);
34 struct pattern_list;
36 /**
37 * Scan the given index and compare its entries to the given pattern list.
38 * If the index is sparse and the pattern list uses cone mode patterns,
39 * then modify the index to contain the all of the file entries within that
40 * new pattern list. This expands sparse directories only as far as needed.
42 * If the pattern list is NULL or does not use cone mode patterns, then the
43 * index is expanded to a full index.
45 void expand_index(struct index_state *istate, struct pattern_list *pl);
47 void ensure_full_index(struct index_state *istate);
49 #endif