Skip to content

Commit 8be8bde

Browse files
mhaggergitster
authored andcommitted
invalidate_ref_cache(): expose this function in the refs API
Make invalidate_ref_cache() an official part of the refs API. It is currently a fact of life that code outside of refs.c mucks about with references. This change gives such code a way of informing the refs module that it should no longer trust its cache. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3870a0d commit 8be8bde

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static struct ref_cache *get_ref_cache(const char *submodule)
202202
return refs;
203203
}
204204

205-
static void invalidate_ref_cache(const char *submodule)
205+
void invalidate_ref_cache(const char *submodule)
206206
{
207207
clear_ref_cache(get_ref_cache(submodule));
208208
}

refs.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ extern void unlock_ref(struct ref_lock *lock);
8080
/** Writes sha1 into the ref specified by the lock. **/
8181
extern int write_ref_sha1(struct ref_lock *lock, const unsigned char *sha1, const char *msg);
8282

83+
/*
84+
* Invalidate the reference cache for the specified submodule. Use
85+
* submodule=NULL to invalidate the cache for the main module. This
86+
* function must be called if references are changed via a mechanism
87+
* other than the refs API.
88+
*/
89+
extern void invalidate_ref_cache(const char *submodule);
90+
8391
/** Setup reflog before using. **/
8492
int log_ref_setup(const char *ref_name, char *logfile, int bufsize);
8593

0 commit comments

Comments
 (0)