]> git.ipfire.org Git - thirdparty/git.git/blobdiff - dir.h
Sync with maint
[thirdparty/git.git] / dir.h
diff --git a/dir.h b/dir.h
index c575f941dc2fd4a8b4602d04da71dd5211f0cba4..5855c065a610b794b3777405bba6f343230b7ea2 100644 (file)
--- 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,