summaryrefslogtreecommitdiff
path: root/dir.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-12-25 19:21:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-12-25 19:21:58 (GMT)
commitbd72a08d6ce451e7d4725d6b3b411d482333e5cb (patch)
tree6a052566ea6c22263d397e023a34685cd0e0d392 /dir.h
parentf3c520e17fa8ed479701e75fe190b37e5e362419 (diff)
parent761e3d26bbe44c51f83c4f1ad198461f57029ebd (diff)
downloadgit-bd72a08d6ce451e7d4725d6b3b411d482333e5cb.zip
git-bd72a08d6ce451e7d4725d6b3b411d482333e5cb.tar.gz
git-bd72a08d6ce451e7d4725d6b3b411d482333e5cb.tar.bz2
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 ...
Diffstat (limited to 'dir.h')
-rw-r--r--dir.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/dir.h b/dir.h
index c575f94..5855c06 100644
--- a/dir.h
+++ b/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,