Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
invalidate_ref_cache(): rename function from invalidate_cached_refs()
author
Michael Haggerty
<mhagger@alum.mit.edu>
Mon, 17 Oct 2011 02:38:05 +0000
(
04:38
+0200)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 17 Oct 2011 04:08:23 +0000
(21:08 -0700)
It is the cache that is being invalidated, not the references, and the
new name makes this unambiguous. Rename other items analogously:
* struct cached_refs -> struct ref_cache
* cached_refs (the variable) -> ref_cache
* clear_cached_refs() -> clear_ref_cache()
* create_cached_refs() -> create_ref_cache()
* get_cached_refs() -> get_ref_cache()
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
8b0e15f
)
diff --git
a/refs.c
b/refs.c
index 9911c97b69a66ba0a4c7d3aff33b9d7b1d006796..02b1ef0a8911762702ae1647265283c3ef8a4d53 100644
(file)
--- a/
refs.c
+++ b/
refs.c
@@
-134,15
+134,15
@@
static struct ref_entry *search_ref_array(struct ref_array *array, const char *n
* Future: need to be in "struct repository"
* when doing a full libification.
*/
* Future: need to be in "struct repository"
* when doing a full libification.
*/
-static struct
cached_refs
{
- struct
cached_refs
*next;
+static struct
ref_cache
{
+ struct
ref_cache
*next;
char did_loose;
char did_packed;
struct ref_array loose;
struct ref_array packed;
/* The submodule name, or "" for the main repo. */
char name[FLEX_ARRAY];
char did_loose;
char did_packed;
struct ref_array loose;
struct ref_array packed;
/* The submodule name, or "" for the main repo. */
char name[FLEX_ARRAY];
-} *
cached_refs
;
+} *
ref_cache
;
static struct ref_entry *current_ref;
static struct ref_entry *current_ref;
@@
-158,7
+158,7
@@
static void free_ref_array(struct ref_array *array)
array->refs = NULL;
}
array->refs = NULL;
}
-static void clear_
cached_refs(struct cached_refs
*ca)
+static void clear_
ref_cache(struct ref_cache
*ca)
{
if (ca->did_loose)
free_ref_array(&ca->loose);
{
if (ca->did_loose)
free_ref_array(&ca->loose);
@@
-167,27
+167,27
@@
static void clear_cached_refs(struct cached_refs *ca)
ca->did_loose = ca->did_packed = 0;
}
ca->did_loose = ca->did_packed = 0;
}
-static struct
cached_refs *create_cached_refs
(const char *submodule)
+static struct
ref_cache *create_ref_cache
(const char *submodule)
{
int len;
{
int len;
- struct
cached_refs
*refs;
+ struct
ref_cache
*refs;
if (!submodule)
submodule = "";
len = strlen(submodule) + 1;
if (!submodule)
submodule = "";
len = strlen(submodule) + 1;
- refs = xcalloc(1, sizeof(struct
cached_refs
) + len);
+ refs = xcalloc(1, sizeof(struct
ref_cache
) + len);
memcpy(refs->name, submodule, len);
return refs;
}
/*
memcpy(refs->name, submodule, len);
return refs;
}
/*
- * Return a pointer to a
cached_refs
for the specified submodule. For
+ * Return a pointer to a
ref_cache
for the specified submodule. For
* the main repository, use submodule==NULL. The returned structure
* will be allocated and initialized but not necessarily populated; it
* should not be freed.
*/
* the main repository, use submodule==NULL. The returned structure
* will be allocated and initialized but not necessarily populated; it
* should not be freed.
*/
-static struct
cached_refs *get_cached_refs
(const char *submodule)
+static struct
ref_cache *get_ref_cache
(const char *submodule)
{
{
- struct
cached_refs *refs = cached_refs
;
+ struct
ref_cache *refs = ref_cache
;
if (!submodule)
submodule = "";
while (refs) {
if (!submodule)
submodule = "";
while (refs) {
@@
-196,17
+196,17
@@
static struct cached_refs *get_cached_refs(const char *submodule)
refs = refs->next;
}
refs = refs->next;
}
- refs = create_
cached_refs
(submodule);
- refs->next =
cached_refs
;
-
cached_refs
= refs;
+ refs = create_
ref_cache
(submodule);
+ refs->next =
ref_cache
;
+
ref_cache
= refs;
return refs;
}
return refs;
}
-static void invalidate_
cached_refs
(void)
+static void invalidate_
ref_cache
(void)
{
{
- struct
cached_refs *refs = cached_refs
;
+ struct
ref_cache *refs = ref_cache
;
while (refs) {
while (refs) {
- clear_
cached_refs
(refs);
+ clear_
ref_cache
(refs);
refs = refs->next;
}
}
refs = refs->next;
}
}
@@
-257,7
+257,7
@@
void clear_extra_refs(void)
static struct ref_array *get_packed_refs(const char *submodule)
{
static struct ref_array *get_packed_refs(const char *submodule)
{
- struct
cached_refs *refs = get_cached_refs
(submodule);
+ struct
ref_cache *refs = get_ref_cache
(submodule);
if (!refs->did_packed) {
const char *packed_refs_file;
if (!refs->did_packed) {
const char *packed_refs_file;
@@
-379,7
+379,7
@@
void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname)
static struct ref_array *get_loose_refs(const char *submodule)
{
static struct ref_array *get_loose_refs(const char *submodule)
{
- struct
cached_refs *refs = get_cached_refs
(submodule);
+ struct
ref_cache *refs = get_ref_cache
(submodule);
if (!refs->did_loose) {
get_ref_dir(submodule, "refs", &refs->loose);
if (!refs->did_loose) {
get_ref_dir(submodule, "refs", &refs->loose);
@@
-1228,7
+1228,7
@@
int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
ret |= repack_without_ref(refname);
unlink_or_warn(git_path("logs/%s", lock->ref_name));
ret |= repack_without_ref(refname);
unlink_or_warn(git_path("logs/%s", lock->ref_name));
- invalidate_
cached_refs
();
+ invalidate_
ref_cache
();
unlock_ref(lock);
return ret;
}
unlock_ref(lock);
return ret;
}
@@
-1527,7
+1527,7
@@
int write_ref_sha1(struct ref_lock *lock,
unlock_ref(lock);
return -1;
}
unlock_ref(lock);
return -1;
}
- invalidate_
cached_refs
();
+ invalidate_
ref_cache
();
if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0 ||
(strcmp(lock->ref_name, lock->orig_ref_name) &&
log_ref_write(lock->orig_ref_name, lock->old_sha1, sha1, logmsg) < 0)) {
if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0 ||
(strcmp(lock->ref_name, lock->orig_ref_name) &&
log_ref_write(lock->orig_ref_name, lock->old_sha1, sha1, logmsg) < 0)) {