diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2011-12-12 06:38:54 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-12-12 09:08:57 -0800 |
commit | 3fe95345190f4590722ee4c1662cab727c64fb70 (patch) | |
tree | 9500c1e0cec8ef5efb801a1f015cbfeeddbb35ad | |
parent | 21969924c3835de3af353181ea015a17211b118a (diff) | |
download | git-3fe95345190f4590722ee4c1662cab727c64fb70.tar.gz |
read_loose_refs(): take a (ref_entry *) as argument
Rename get_ref_dir() to read_loose_refs(), and change its signature.
This is another step towards reading loose references one directory
at a time.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -770,21 +770,20 @@ static struct ref_entry *get_packed_refs(struct ref_cache *refs) } /* - * dirname must match the name associated with dir; in particular, it - * must end with '/'. + * Fill direntry with loose references read from the filesystem. */ -static void get_ref_dir(struct ref_cache *refs, const char *dirname) +static void read_loose_refs(struct ref_entry *direntry) { DIR *d; char *path; + char *dirname = direntry->name; int dirnamelen = strlen(dirname); int pathlen; - struct ref_entry *direntry; - - assert(dirnamelen && dirname[dirnamelen - 1] == '/'); - - direntry = find_containing_direntry(refs->loose, dirname, 1); + struct ref_cache *refs; + assert(direntry->flag & REF_DIR); + assert(dirnamelen && direntry->name[dirnamelen - 1] == '/'); + refs = direntry->u.subdir.ref_cache; if (*refs->name) path = git_path_submodule(refs->name, "%s", dirname); else @@ -822,7 +821,9 @@ static void get_ref_dir(struct ref_cache *refs, const char *dirname) if (S_ISDIR(st.st_mode)) { refname[dirnamelen + namelen] = '/'; refname[dirnamelen + namelen + 1] = '\0'; - get_ref_dir(refs, refname); + read_loose_refs(find_containing_direntry( + refs->loose, + refname, 1)); continue; } if (*refs->name) { @@ -847,7 +848,7 @@ static struct ref_entry *get_loose_refs(struct ref_cache *refs) { if (!refs->loose) { refs->loose = create_dir_entry(refs, ""); - get_ref_dir(refs, "refs/"); + read_loose_refs(find_containing_direntry(refs->loose, "refs/", 1)); } return refs->loose; } |