aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-10-17 04:38:07 +0200
committerJunio C Hamano <gitster@pobox.com>2011-10-16 21:10:49 -0700
commit8be8bde75f90661ecd118ac890290889e184063d (patch)
treefb225b2b6bc2bbedd7f1902773830ed465ede3f4
parent3870a0d1d88e2e42b70c2586d3a1fda63226953c (diff)
downloadgit-8be8bde75f90661ecd118ac890290889e184063d.tar.gz
git-8be8bde75f90661ecd118ac890290889e184063d.tar.xz
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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--refs.c2
-rw-r--r--refs.h8
2 files changed, 9 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 68b73aa14..ddd799e65 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 0229c5713..f439c54eb 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);