From 9893d376eea1624870a844ef6644c837062b1751 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Sat, 18 Jan 2020 15:41:20 +0000 Subject: git_attr_cache_flush: return an int Stop returning a void for functions, future-proofing them to allow them to fail. --- include/git2/attr.h | 5 ++++- src/attrcache.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/git2/attr.h b/include/git2/attr.h index 72e43806c..a3ab5a7a2 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 21a1fea24..f02dd9d1d 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) -- cgit v1.2.1