From: Michael Haggerty <mhagger@xxxxxxxxxxxx> Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx> --- refs.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index 140fbe2..2057380 100644 --- a/refs.c +++ b/refs.c @@ -769,11 +769,11 @@ void add_packed_ref(const char *refname, const unsigned char *sha1) /* * Read the loose references for refs from the namespace dirname. - * dirname must end with '/'. dir must be the directory entry + * dirname must end with '/'. direntry must be the directory entry * corresponding to dirname. */ static void get_ref_dir(struct ref_cache *refs, const char *dirname, - struct ref_dir *dir) + struct ref_entry *direntry) { DIR *d; const char *path; @@ -781,6 +781,8 @@ static void get_ref_dir(struct ref_cache *refs, const char *dirname, int dirnamelen = strlen(dirname); struct strbuf refname; + assert(direntry->flag & REF_DIR); + if (*refs->name) path = git_path_submodule(refs->name, "%s", dirname); else @@ -812,7 +814,8 @@ static void get_ref_dir(struct ref_cache *refs, const char *dirname, } else if (S_ISDIR(st.st_mode)) { strbuf_addch(&refname, '/'); get_ref_dir(refs, refname.buf, - &search_for_subdir(dir, refname.buf, 1)->u.subdir); + search_for_subdir(&direntry->u.subdir, + refname.buf, 1)); } else { if (*refs->name) { hashclr(sha1); @@ -825,7 +828,7 @@ static void get_ref_dir(struct ref_cache *refs, const char *dirname, hashclr(sha1); flag |= REF_ISBROKEN; } - add_entry_to_dir(dir, + add_entry_to_dir(&direntry->u.subdir, create_ref_entry(refname.buf, sha1, flag, 1)); } strbuf_setlen(&refname, dirnamelen); @@ -839,8 +842,8 @@ static struct ref_entry *get_loose_refs(struct ref_cache *refs) if (!refs->loose) { refs->loose = create_dir_entry(""); get_ref_dir(refs, "refs/", - &search_for_subdir(&refs->loose->u.subdir, - "refs/", 1)->u.subdir); + search_for_subdir(&refs->loose->u.subdir, + "refs/", 1)); } return refs->loose; } -- 1.7.10 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html