diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2019-09-09 13:06:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-09 13:06:22 +0200 |
| commit | 17d6cd453b8b2d1e52b8e617604abe2970f743ca (patch) | |
| tree | 43e16b5f3ccb56769ef303d89805dd5d6edb4a21 /src | |
| parent | 4d3392ddd8c82105606bf998522e9bc395aace01 (diff) | |
| parent | a7b4b639936709dbf53d09077b307edb4a633303 (diff) | |
| download | libgit2-17d6cd453b8b2d1e52b8e617604abe2970f743ca.tar.gz | |
Merge pull request #5210 from buddyspike/master
ignore: correct handling of nested rules overriding wild card unignore
Diffstat (limited to 'src')
| -rw-r--r-- | src/ignore.c | 9 |
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; } |
