[PATCH 12/30] get_loose_refs(): return (ref_entry *) instead of (ref_dir *)
From: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/refs.c b/refs.c
index 24930ab..0259ad1 100644
--- a/refs.c
+++ b/refs.c
@@ -830,7 +830,7 @@ static void get_ref_dir(struct ref_cache *refs, const char *dirname,
closedir(d);
}
-static struct ref_dir *get_loose_refs(struct ref_cache *refs)
+static struct ref_entry *get_loose_refs(struct ref_cache *refs)
{
if (!refs->loose) {
refs->loose = create_dir_entry("");
@@ -838,7 +838,7 @@ static struct ref_dir *get_loose_refs(struct ref_cache *refs)
&search_for_subdir(&refs->loose->u.subdir,
"refs/", 1)->u.subdir);
}
- return &refs->loose->u.subdir;
+ return refs->loose;
}
/* We allow "recursive" symbolic refs. Only within reason, though */
@@ -1165,7 +1165,8 @@ static int do_for_each_ref(const char *submodule, const char *base, each_ref_fn
struct ref_cache *refs = get_ref_cache(submodule);
struct ref_entry *packed_direntry = get_packed_refs(refs);
struct ref_dir *packed_dir = &packed_direntry->u.subdir;
- struct ref_dir *loose_dir = get_loose_refs(refs);
+ struct ref_entry *loose_direntry = get_loose_refs(refs);
+ struct ref_dir *loose_dir = &loose_direntry->u.subdir;
int retval = 0;
if (base && *base) {
@@ -1711,7 +1712,7 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
if (!is_refname_available(newrefname, oldrefname, &get_packed_refs(refs)->u.subdir))
return 1;
- if (!is_refname_available(newrefname, oldrefname, get_loose_refs(refs)))
+ if (!is_refname_available(newrefname, oldrefname, &get_loose_refs(refs)->u.subdir))
return 1;
if (log && rename(git_path("logs/%s", oldrefname), git_path(TMP_RENAMED_LOG)))
--
1.7.10