summaryrefslogtreecommitdiff
path: root/src/attr_file.c
diff options
context:
space:
mode:
authorJ Wyman <jeremy.wyman@microsoft.com>2015-03-30 14:07:44 -0700
committerEdward Thomson <ethomson@microsoft.com>2015-04-28 14:24:58 -0400
commit4c09e19a3764a1e5f3340dabf8104dfed32e7673 (patch)
tree8df38e74e802445528d626d37276e8b119a7eb46 /src/attr_file.c
parentd969d41547080d5e924d49f44ba5de1ade5b343c (diff)
downloadlibgit2-4c09e19a3764a1e5f3340dabf8104dfed32e7673.tar.gz
Improvements to ignore performance on Windows.
Minimizing the number directory and file opens, minimizes the amount of IO thus reducing the overall cost of performing ignore operations.
Diffstat (limited to 'src/attr_file.c')
-rw-r--r--src/attr_file.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/attr_file.c b/src/attr_file.c
index eed39661f..ef98aacc2 100644
--- a/src/attr_file.c
+++ b/src/attr_file.c
@@ -457,7 +457,7 @@ git_attr_assignment *git_attr_rule__lookup_assignment(
}
int git_attr_path__init(
- git_attr_path *info, const char *path, const char *base)
+ git_attr_path *info, const char *path, const char *base, git_dir_flag dir_flag)
{
ssize_t root;
@@ -488,7 +488,21 @@ int git_attr_path__init(
if (!info->basename || !*info->basename)
info->basename = info->path;
- info->is_dir = (int)git_path_isdir(info->full.ptr);
+ switch (dir_flag)
+ {
+ case GIT_DIR_FLAG_FALSE:
+ info->is_dir = 0;
+ break;
+
+ case GIT_DIR_FLAG_TRUE:
+ info->is_dir = 1;
+ break;
+
+ case GIT_DIR_FLAG_UNKNOWN:
+ default:
+ info->is_dir = (int)git_path_isdir(info->full.ptr);
+ break;
+ }
return 0;
}