git_attr_cache_flush: return an int Stop returning a void for functions, future-proofing them to allow them to fail.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
diff --git a/include/git2/attr.h b/include/git2/attr.h
index 72e4380..a3ab5a7 100644
--- a/include/git2/attr.h
+++ b/include/git2/attr.h
@@ -238,8 +238,11 @@ GIT_EXTERN(int) git_attr_foreach(
* disk no longer match the cached contents of memory. This will cause
* the attributes files to be reloaded the next time that an attribute
* access function is called.
+ *
+ * @param repo The repository containing the gitattributes cache
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_attr_cache_flush(
+GIT_EXTERN(int) git_attr_cache_flush(
git_repository *repo);
/**
diff --git a/src/attrcache.c b/src/attrcache.c
index 21a1fea..f02dd9d 100644
--- a/src/attrcache.c
+++ b/src/attrcache.c
@@ -411,7 +411,7 @@ cancel:
return ret;
}
-void git_attr_cache_flush(git_repository *repo)
+int git_attr_cache_flush(git_repository *repo)
{
git_attr_cache *cache;
@@ -420,6 +420,8 @@ void git_attr_cache_flush(git_repository *repo)
*/
if (repo && (cache = git__swap(repo->attrcache, NULL)) != NULL)
attr_cache__free(cache);
+
+ return 0;
}
int git_attr_cache__insert_macro(git_repository *repo, git_attr_rule *macro)