summaryrefslogtreecommitdiff
path: root/src/ignore.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-04-26 10:51:45 -0700
committerRussell Belfer <rb@github.com>2012-04-26 10:51:45 -0700
commitd58336dda873704f8d12a8b78c3191deefa4ec14 (patch)
tree84137abc698a572015d41975ced985fc0bd77e61 /src/ignore.c
parenteb3d71a5bcd78cb4840e62194e8998141508af88 (diff)
downloadlibgit2-d58336dda873704f8d12a8b78c3191deefa4ec14.tar.gz
Fix leading slash behavior in attrs/ignores
We were not following the git behavior for leading slashes in path names when matching git ignores and git attribute file patterns. This should fix issue #638.
Diffstat (limited to 'src/ignore.c')
-rw-r--r--src/ignore.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ignore.c b/src/ignore.c
index 165754b4d..20b96c602 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -176,20 +176,23 @@ int git_ignore__lookup(git_ignores *ignores, const char *pathname, int *ignored)
/* first process builtins - success means path was found */
if (ignore_lookup_in_rules(
&ignores->ign_internal->rules, &path, ignored))
- return 0;
+ goto cleanup;
/* next process files in the path */
git_vector_foreach(&ignores->ign_path, i, file) {
if (ignore_lookup_in_rules(&file->rules, &path, ignored))
- return 0;
+ goto cleanup;
}
/* last process global ignores */
git_vector_foreach(&ignores->ign_global, i, file) {
if (ignore_lookup_in_rules(&file->rules, &path, ignored))
- return 0;
+ goto cleanup;
}
*ignored = 0;
+
+cleanup:
+ git_attr_path__free(&path);
return 0;
}