diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/attr.c | 7 | ||||
| -rw-r--r-- | src/attr.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/attr.c b/src/attr.c index ddcc3dcf0..17571f6a8 100644 --- a/src/attr.c +++ b/src/attr.c @@ -210,6 +210,13 @@ int git_attr_add_macro( return error; } +int git_attr_cache__is_cached(git_repository *repo, const char *path) +{ + const char *cache_key = path; + if (repo && git__prefixcmp(cache_key, git_repository_workdir(repo)) == 0) + cache_key += strlen(git_repository_workdir(repo)); + return (git_hashtable_lookup(repo->attrcache.files, cache_key) == NULL); +} /* add git_attr_file to vector of files, loading if needed */ int git_attr_cache__push_file( diff --git a/src/attr.h b/src/attr.h index a758cc4bd..ea27259f1 100644 --- a/src/attr.h +++ b/src/attr.h @@ -27,4 +27,7 @@ extern int git_attr_cache__push_file( const char *filename, int (*loader)(git_repository *, const char *, git_attr_file *)); +/* returns GIT_SUCCESS if path is in cache */ +extern int git_attr_cache__is_cached(git_repository *repo, const char *path); + #endif |
