Skip to content

Commit

Permalink
invalidate_ref_cache(): expose this function in the refs API
Browse files Browse the repository at this point in the history
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 <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Oct 17, 2011
1 parent 3870a0d commit 8be8bde
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
8 changes: 8 additions & 0 deletions refs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 8be8bde

Please sign in to comment.