Skip to content

Commit 9893d37

Browse files
committed
git_attr_cache_flush: return an int
Stop returning a void for functions, future-proofing them to allow them to fail.
1 parent 4460bf4 commit 9893d37

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

include/git2/attr.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,11 @@ GIT_EXTERN(int) git_attr_foreach(
238238
* disk no longer match the cached contents of memory. This will cause
239239
* the attributes files to be reloaded the next time that an attribute
240240
* access function is called.
241+
*
242+
* @param repo The repository containing the gitattributes cache
243+
* @return 0 on success, or an error code
241244
*/
242-
GIT_EXTERN(void) git_attr_cache_flush(
245+
GIT_EXTERN(int) git_attr_cache_flush(
243246
git_repository *repo);
244247

245248
/**

src/attrcache.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ int git_attr_cache__init(git_repository *repo)
411411
return ret;
412412
}
413413

414-
void git_attr_cache_flush(git_repository *repo)
414+
int git_attr_cache_flush(git_repository *repo)
415415
{
416416
git_attr_cache *cache;
417417

@@ -420,6 +420,8 @@ void git_attr_cache_flush(git_repository *repo)
420420
*/
421421
if (repo && (cache = git__swap(repo->attrcache, NULL)) != NULL)
422422
attr_cache__free(cache);
423+
424+
return 0;
423425
}
424426

425427
int git_attr_cache__insert_macro(git_repository *repo, git_attr_rule *macro)

0 commit comments

Comments
 (0)