int baselen, struct pattern_list *pl, int srcpos)
{
struct path_pattern *pattern;
int baselen, struct pattern_list *pl, int srcpos)
{
struct path_pattern *pattern;
- parse_exclude_pattern(&string, &patternlen, &flags, &nowildcardlen);
+ parse_path_pattern(&string, &patternlen, &flags, &nowildcardlen);
if (flags & PATTERN_FLAG_MUSTBEDIR) {
FLEXPTR_ALLOC_MEM(pattern, pattern, string, patternlen);
} else {
if (flags & PATTERN_FLAG_MUSTBEDIR) {
FLEXPTR_ALLOC_MEM(pattern, pattern, string, patternlen);
} else {
* Frees memory within pl which was allocated for exclude patterns and
* the file buffer. Does not free pl itself.
*/
* Frees memory within pl which was allocated for exclude patterns and
* the file buffer. Does not free pl itself.
*/
const char *base, int baselen,
struct pattern_list *pl);
const char *base, int baselen,
struct pattern_list *pl);
-static int add_excludes(const char *fname, const char *base, int baselen,
+static int add_patterns(const char *fname, const char *base, int baselen,
struct pattern_list *pl, struct index_state *istate,
struct oid_stat *oid_stat)
{
struct pattern_list *pl, struct index_state *istate,
struct oid_stat *oid_stat)
{
- add_excludes_from_buffer(buf, size, base, baselen, pl);
+ add_patterns_from_buffer(buf, size, base, baselen, pl);
if (entry != buf + i && entry[0] != '#') {
buf[i - (i && buf[i-1] == '\r')] = 0;
trim_trailing_spaces(entry);
if (entry != buf + i && entry[0] != '#') {
buf[i - (i && buf[i-1] == '\r')] = 0;
trim_trailing_spaces(entry);
- add_exclude(entry, base, baselen, pl, lineno);
+ add_pattern(entry, base, baselen, pl, lineno);
int baselen, struct pattern_list *pl,
struct index_state *istate)
{
int baselen, struct pattern_list *pl,
struct index_state *istate)
{
- return add_excludes(fname, base, baselen, pl, istate, NULL);
+ return add_patterns(fname, base, baselen, pl, istate, NULL);
- add_excludes_from_buffer(buf, size, base, baselen, pl);
+ add_patterns_from_buffer(buf, size, base, baselen, pl);
- pl = add_exclude_list(dir, EXC_FILE, fname);
- if (add_excludes(fname, "", 0, pl, NULL, oid_stat) < 0)
+ pl = add_pattern_list(dir, EXC_FILE, fname);
+ if (add_patterns(fname, "", 0, pl, NULL, oid_stat) < 0)
* any, determines the fate. Returns the exclude_list element which
* matched, or NULL for undecided.
*/
* any, determines the fate. Returns the exclude_list element which
* matched, or NULL for undecided.
*/
struct pattern_list *pl, struct index_state *istate)
{
struct path_pattern *pattern;
struct pattern_list *pl, struct index_state *istate)
{
struct path_pattern *pattern;
- pattern = last_exclude_matching_from_list(pathname, pathlen, basename,
+ pattern = last_matching_pattern_from_list(pathname, pathlen, basename,
struct dir_struct *dir, struct index_state *istate,
const char *pathname, int pathlen,
const char *basename, int *dtype_p)
struct dir_struct *dir, struct index_state *istate,
const char *pathname, int pathlen,
const char *basename, int *dtype_p)
for (i = EXC_CMDL; i <= EXC_FILE; i++) {
group = &dir->exclude_list_group[i];
for (j = group->nr - 1; j >= 0; j--) {
for (i = EXC_CMDL; i <= EXC_FILE; i++) {
group = &dir->exclude_list_group[i];
for (j = group->nr - 1; j >= 0; j--) {
pathname, pathlen, basename, dtype_p,
&group->pl[j], istate);
if (pattern)
pathname, pathlen, basename, dtype_p,
&group->pl[j], istate);
if (pattern)
strbuf_add(&dir->basebuf, base + current, stk->baselen - current);
assert(stk->baselen == dir->basebuf.len);
strbuf_add(&dir->basebuf, base + current, stk->baselen - current);
assert(stk->baselen == dir->basebuf.len);
istate,
dir->basebuf.buf, stk->baselen - 1,
dir->basebuf.buf + current, &dt);
istate,
dir->basebuf.buf, stk->baselen - 1,
dir->basebuf.buf + current, &dt);
* need fname to remain unchanged to ensure the src
* member of each struct path_pattern correctly
* back-references its source file. Other invocations
* need fname to remain unchanged to ensure the src
* member of each struct path_pattern correctly
* back-references its source file. Other invocations
* strbuf_detach() and free() here in the caller.
*/
struct strbuf sb = STRBUF_INIT;
strbuf_addbuf(&sb, &dir->basebuf);
strbuf_addstr(&sb, dir->exclude_per_dir);
pl->src = strbuf_detach(&sb, NULL);
* strbuf_detach() and free() here in the caller.
*/
struct strbuf sb = STRBUF_INIT;
strbuf_addbuf(&sb, &dir->basebuf);
strbuf_addstr(&sb, dir->exclude_per_dir);
pl->src = strbuf_detach(&sb, NULL);
- add_excludes(pl->src, pl->src, stk->baselen, pl, istate,
+ add_patterns(pl->src, pl->src, stk->baselen, pl, istate,
untracked ? &oid_stat : NULL);
}
/*
* NEEDSWORK: when untracked cache is enabled, prep_exclude()
* will first be called in valid_cached_dir() then maybe many
untracked ? &oid_stat : NULL);
}
/*
* NEEDSWORK: when untracked cache is enabled, prep_exclude()
* will first be called in valid_cached_dir() then maybe many
- * times more in last_exclude_matching(). When the cache is
- * used, last_exclude_matching() will not be called and
+ * times more in last_matching_pattern(). When the cache is
+ * used, last_matching_pattern() will not be called and
* reading .gitignore content will be a waste.
*
* So when it's called by valid_cached_dir() and we can get
* .gitignore SHA-1 from the index (i.e. .gitignore is not
* modified on work tree), we could delay reading the
* .gitignore content until we absolutely need it in
* reading .gitignore content will be a waste.
*
* So when it's called by valid_cached_dir() and we can get
* .gitignore SHA-1 from the index (i.e. .gitignore is not
* modified on work tree), we could delay reading the
* .gitignore content until we absolutely need it in
- return last_exclude_matching_from_lists(dir, istate, pathname, pathlen,
+ return last_matching_pattern_from_lists(dir, istate, pathname, pathlen,
const char *pathname, int *dtype_p)
{
struct path_pattern *pattern =
const char *pathname, int *dtype_p)
{
struct path_pattern *pattern =
- last_exclude_matching(dir, istate, pathname, dtype_p);
+ last_matching_pattern(dir, istate, pathname, dtype_p);
* need it now to determine the validity of the cache for this
* path. The next calls will be nearly no-op, the way
* prep_exclude() is designed.
* need it now to determine the validity of the cache for this
* path. The next calls will be nearly no-op, the way
* prep_exclude() is designed.
if (!excludes_file)
excludes_file = xdg_config_home("ignore");
if (excludes_file && !access_or_warn(excludes_file, R_OK, 0))
if (!excludes_file)
excludes_file = xdg_config_home("ignore");
if (excludes_file && !access_or_warn(excludes_file, R_OK, 0))
dir->untracked ? &dir->ss_excludes_file : NULL);
/* per repository user preference */
if (startup_info->have_repository) {
const char *path = git_path_info_exclude();
if (!access_or_warn(path, R_OK, 0))
dir->untracked ? &dir->ss_excludes_file : NULL);
/* per repository user preference */
if (startup_info->have_repository) {
const char *path = git_path_info_exclude();
if (!access_or_warn(path, R_OK, 0))