diff --git a/refs.c b/refs.c index 68b73aa1450f483a3116e045193a879515ecdb84..ddd799e65bdcc29ebd2dc5d530488b341b166f4d 100644 --- a/refs.c +++ b/refs.c @@ -202,7 +202,7 @@ static struct ref_cache *get_ref_cache(const char *submodule) return refs; } -static void invalidate_ref_cache(const char *submodule) +void invalidate_ref_cache(const char *submodule) { clear_ref_cache(get_ref_cache(submodule)); } diff --git a/refs.h b/refs.h index 0229c57132f53b85e4d6af8b62627383a49527ac..f439c54eb23f11e084ad9f8299d17e2ad888424b 100644 --- a/refs.h +++ b/refs.h @@ -80,6 +80,14 @@ extern void unlock_ref(struct ref_lock *lock); /** Writes sha1 into the ref specified by the lock. **/ extern int write_ref_sha1(struct ref_lock *lock, const unsigned char *sha1, const char *msg); +/* + * Invalidate the reference cache for the specified submodule. Use + * submodule=NULL to invalidate the cache for the main module. This + * function must be called if references are changed via a mechanism + * other than the refs API. + */ +extern void invalidate_ref_cache(const char *submodule); + /** Setup reflog before using. **/ int log_ref_setup(const char *ref_name, char *logfile, int bufsize);