mirror of
https://github.com/git/git.git
synced 2024-11-27 03:53:55 +08:00
537e516a39
When running 'git sparse-checkout disable' with the sparse index enabled, Git is expected to expand the index into a full index. However, it currently outputs the advice message saying that that is unexpected and likely due to an issue with the working directory. Disable this advice message when in this code path. Establish a pattern for doing a similar removal in the future. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
50 lines
1.8 KiB
C
50 lines
1.8 KiB
C
#ifndef SPARSE_INDEX_H__
|
|
#define SPARSE_INDEX_H__
|
|
|
|
/*
|
|
* If performing an operation where the index is supposed to expand to a
|
|
* full index, then disable the advice message by setting this global to
|
|
* zero.
|
|
*/
|
|
extern int give_advice_on_expansion;
|
|
|
|
struct index_state;
|
|
#define SPARSE_INDEX_MEMORY_ONLY (1 << 0)
|
|
int is_sparse_index_allowed(struct index_state *istate, int flags);
|
|
int convert_to_sparse(struct index_state *istate, int flags);
|
|
void ensure_correct_sparsity(struct index_state *istate);
|
|
void clear_skip_worktree_from_present_files(struct index_state *istate);
|
|
|
|
/*
|
|
* Some places in the codebase expect to search for a specific path.
|
|
* This path might be outside of the sparse-checkout definition, in
|
|
* which case a sparse-index may not contain a path for that index.
|
|
*
|
|
* Given an index and a path, check to see if a leading directory for
|
|
* 'path' exists in the index as a sparse directory. In that case,
|
|
* expand that sparse directory to a full range of cache entries and
|
|
* populate the index accordingly.
|
|
*/
|
|
void expand_to_path(struct index_state *istate,
|
|
const char *path, size_t pathlen, int icase);
|
|
|
|
struct repository;
|
|
int set_sparse_index_config(struct repository *repo, int enable);
|
|
|
|
struct pattern_list;
|
|
|
|
/**
|
|
* Scan the given index and compare its entries to the given pattern list.
|
|
* If the index is sparse and the pattern list uses cone mode patterns,
|
|
* then modify the index to contain the all of the file entries within that
|
|
* new pattern list. This expands sparse directories only as far as needed.
|
|
*
|
|
* If the pattern list is NULL or does not use cone mode patterns, then the
|
|
* index is expanded to a full index.
|
|
*/
|
|
void expand_index(struct index_state *istate, struct pattern_list *pl);
|
|
|
|
void ensure_full_index(struct index_state *istate);
|
|
|
|
#endif
|