Commit 9893d376eea1624870a844ef6644c837062b1751

Edward Thomson 2020-01-18T15:41:20

git_attr_cache_flush: return an int Stop returning a void for functions, future-proofing them to allow them to fail.

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)