Commit e4eb94a2559ca669412d318112a200ead1222466

Russell Belfer 2012-01-31T14:02:52

Fix issue with ignoring whole directories Now that is_dir is calculated correctly for attr/ignore paths, it is possible to use it so that ignoring "dir/" will properly match the directory name and ignore the entire directory.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/attr_file.c b/src/attr_file.c
index 74b2b6d..7911381 100644
--- a/src/attr_file.c
+++ b/src/attr_file.c
@@ -200,6 +200,8 @@ int git_attr_fnmatch__match(
 
 	if (match->flags & GIT_ATTR_FNMATCH_FULLPATH)
 		matched = p_fnmatch(match->pattern, path->path, FNM_PATHNAME);
+	else if (path->is_dir)
+		matched = p_fnmatch(match->pattern, path->basename, FNM_LEADING_DIR);
 	else
 		matched = p_fnmatch(match->pattern, path->basename, 0);