summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ignore.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ignore.c b/src/ignore.c
index c2d99444b..f5fb507e6 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -444,7 +444,7 @@ static bool ignore_lookup_in_rules(
int git_ignore__lookup(
int *out, git_ignores *ignores, const char *pathname, git_dir_flag dir_flag)
{
- unsigned int i;
+ size_t i;
git_attr_file *file;
git_attr_path path;
@@ -458,8 +458,11 @@ int git_ignore__lookup(
if (ignore_lookup_in_rules(out, ignores->ign_internal, &path))
goto cleanup;
- /* next process files in the path */
- git_vector_foreach(&ignores->ign_path, i, file) {
+ /* next process files in the path.
+ * this process has to process ignores in reverse order
+ * to ensure correct prioritization of rules
+ */
+ git_vector_rforeach(&ignores->ign_path, i, file) {
if (ignore_lookup_in_rules(out, file, &path))
goto cleanup;
}