Merge branch 'ds/sparse-cone'
Management of sparsely checked-out working tree has gained a dedicated "sparse-checkout" command. * ds/sparse-cone: (21 commits) sparse-checkout: improve OS ls compatibility sparse-checkout: respect core.ignoreCase in cone mode sparse-checkout: check for dirty status sparse-checkout: update working directory in-process for 'init' sparse-checkout: cone mode should not interact with .gitignore sparse-checkout: write using lockfile sparse-checkout: use in-process update for disable subcommand sparse-checkout: update working directory in-process sparse-checkout: sanitize for nested folders unpack-trees: add progress to clear_ce_flags() unpack-trees: hash less in cone mode sparse-checkout: init and set in cone mode sparse-checkout: use hashmaps for cone patterns sparse-checkout: add 'cone' mode trace2: add region in clear_ce_flags sparse-checkout: create 'disable' subcommand sparse-checkout: add '--stdin' option to set subcommand sparse-checkout: 'set' subcommand clone: add --sparse mode sparse-checkout: create 'init' subcommand ...
This commit is contained in:
36
dir.h
36
dir.h
@@ -2,6 +2,7 @@
|
||||
#define DIR_H
|
||||
|
||||
#include "cache.h"
|
||||
#include "hashmap.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
/**
|
||||
@@ -70,6 +71,13 @@ struct path_pattern {
|
||||
int srcpos;
|
||||
};
|
||||
|
||||
/* used for hashmaps for cone patterns */
|
||||
struct pattern_entry {
|
||||
struct hashmap_entry ent;
|
||||
char *pattern;
|
||||
size_t patternlen;
|
||||
};
|
||||
|
||||
/*
|
||||
* Each excludes file will be parsed into a fresh exclude_list which
|
||||
* is appended to the relevant exclude_list_group (either EXC_DIRS or
|
||||
@@ -88,6 +96,26 @@ struct pattern_list {
|
||||
const char *src;
|
||||
|
||||
struct path_pattern **patterns;
|
||||
|
||||
/*
|
||||
* While scanning the excludes, we attempt to match the patterns
|
||||
* with a more restricted set that allows us to use hashsets for
|
||||
* matching logic, which is faster than the linear lookup in the
|
||||
* excludes array above. If non-zero, that check succeeded.
|
||||
*/
|
||||
unsigned use_cone_patterns;
|
||||
unsigned full_cone;
|
||||
|
||||
/*
|
||||
* Stores paths where everything starting with those paths
|
||||
* is included.
|
||||
*/
|
||||
struct hashmap recursive_hashmap;
|
||||
|
||||
/*
|
||||
* Used to check single-level parents of blobs.
|
||||
*/
|
||||
struct hashmap parent_hashmap;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -345,6 +373,7 @@ enum pattern_match_result {
|
||||
UNDECIDED = -1,
|
||||
NOT_MATCHED = 0,
|
||||
MATCHED = 1,
|
||||
MATCHED_RECURSIVE = 2,
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -380,6 +409,13 @@ int is_excluded(struct dir_struct *dir,
|
||||
struct index_state *istate,
|
||||
const char *name, int *dtype);
|
||||
|
||||
int pl_hashmap_cmp(const void *unused_cmp_data,
|
||||
const struct hashmap_entry *a,
|
||||
const struct hashmap_entry *b,
|
||||
const void *key);
|
||||
int hashmap_contains_parent(struct hashmap *map,
|
||||
const char *path,
|
||||
struct strbuf *buffer);
|
||||
struct pattern_list *add_pattern_list(struct dir_struct *dir,
|
||||
int group_type, const char *src);
|
||||
int add_patterns_from_file_to_list(const char *fname, const char *base, int baselen,
|
||||
|
||||
Reference in New Issue
Block a user