add a howto document about corrupted blob recovery
[git/debian.git] / dir.h
blobaaa247b2569fc5ae923f12dcd3cdede5c2dccd8d
1 #ifndef DIR_H
2 #define DIR_H
4 /*
5 * We maintain three exclude pattern lists:
6 * EXC_CMDL lists patterns explicitly given on the command line.
7 * EXC_DIRS lists patterns obtained from per-directory ignore files.
8 * EXC_FILE lists patterns from fallback ignore files.
9 */
10 #define EXC_CMDL 0
11 #define EXC_DIRS 1
12 #define EXC_FILE 2
15 struct dir_entry {
16 unsigned int len;
17 char name[FLEX_ARRAY]; /* more */
20 #define EXC_FLAG_NODIR 1
21 #define EXC_FLAG_NOWILDCARD 2
22 #define EXC_FLAG_ENDSWITH 4
24 struct exclude_list {
25 int nr;
26 int alloc;
27 struct exclude {
28 const char *pattern;
29 int patternlen;
30 const char *base;
31 int baselen;
32 int to_exclude;
33 int flags;
34 } **excludes;
37 struct dir_struct {
38 int nr, alloc;
39 int ignored_nr, ignored_alloc;
40 unsigned int show_ignored:1,
41 show_other_directories:1,
42 hide_empty_directories:1,
43 no_gitlinks:1,
44 collect_ignored:1;
45 struct dir_entry **entries;
46 struct dir_entry **ignored;
48 /* Exclude info */
49 const char *exclude_per_dir;
50 struct exclude_list exclude_list[3];
53 extern int common_prefix(const char **pathspec);
55 #define MATCHED_RECURSIVELY 1
56 #define MATCHED_FNMATCH 2
57 #define MATCHED_EXACTLY 3
58 extern int match_pathspec(const char **pathspec, const char *name, int namelen, int prefix, char *seen);
60 extern int read_directory(struct dir_struct *, const char *path, const char *base, int baselen, const char **pathspec);
61 extern int push_exclude_per_directory(struct dir_struct *, const char *, int);
62 extern void pop_exclude_per_directory(struct dir_struct *, int);
64 extern int excluded(struct dir_struct *, const char *);
65 extern void add_excludes_from_file(struct dir_struct *, const char *fname);
66 extern void add_exclude(const char *string, const char *base,
67 int baselen, struct exclude_list *which);
68 extern int file_exists(const char *);
69 extern struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int len);
71 extern char *get_relative_cwd(char *buffer, int size, const char *dir);
72 extern int is_inside_dir(const char *dir);
74 extern int remove_dir_recursively(struct strbuf *path, int only_empty);
76 #endif