Thread (32 messages) flat view 32 messages, 1 author, 2016-06-15
STALE3741d

[PATCH 28/30] read_loose_refs(): access ref_cache via the ref_dir field

From: <hidden>
Date: 2016-06-15 22:53:39
Subsystem: the rest · Maintainer: Linus Torvalds

From: Michael Haggerty <redacted>

This means that all we need to read loose references is the ref_entry
that will receive them.

Signed-off-by: Michael Haggerty <redacted>
---
 refs.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/refs.c b/refs.c
index 0f5aab2..4eca965 100644
--- a/refs.c
+++ b/refs.c
@@ -791,7 +791,7 @@ void add_packed_ref(const char *refname, const unsigned char *sha1)
 /*
  * Read the loose references for direntry in refs.
  */
-static void read_loose_refs(struct ref_cache *refs, struct ref_entry *direntry)
+static void read_loose_refs(struct ref_entry *direntry)
 {
 	DIR *d;
 	const char *path;
@@ -799,9 +799,11 @@ static void read_loose_refs(struct ref_cache *refs, struct ref_entry *direntry)
 	const char *dirname = direntry->name;
 	int dirnamelen = strlen(dirname);
 	struct strbuf refname;
+	struct ref_cache *refs;
 
 	assert(direntry->flag & REF_DIR);
 
+	refs = direntry->u.subdir.ref_cache;
 	if (*refs->name)
 		path = git_path_submodule(refs->name, "%s", dirname);
 	else
@@ -832,8 +834,7 @@ static void read_loose_refs(struct ref_cache *refs, struct ref_entry *direntry)
 			/* Silently ignore. */
 		} else if (S_ISDIR(st.st_mode)) {
 			strbuf_addch(&refname, '/');
-			read_loose_refs(refs,
-					search_for_subdir(direntry,
+			read_loose_refs(search_for_subdir(direntry,
 							  refname.buf, 1));
 		} else {
 			if (*refs->name) {
@@ -860,8 +861,7 @@ static struct ref_entry *get_loose_refs(struct ref_cache *refs)
 {
 	if (!refs->loose) {
 		refs->loose = create_dir_entry(refs, "");
-		read_loose_refs(refs,
-				search_for_subdir(refs->loose, "refs/", 1));
+		read_loose_refs(search_for_subdir(refs->loose, "refs/", 1));
 	}
 	return refs->loose;
 }
-- 
1.7.10
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help