mirror of
https://github.com/git/git
synced 2024-10-05 16:19:28 +00:00
search_for_subdir(): return (ref_dir *) instead of (ref_entry *)
That is what all the callers want, so give it to them. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
d7826d5427
commit
3f3aa1bc62
19
refs.c
19
refs.c
|
@ -289,7 +289,7 @@ static struct ref_entry *search_ref_dir(struct ref_dir *dir, const char *refname
|
||||||
* directory if it is missing; otherwise, return NULL if the desired
|
* directory if it is missing; otherwise, return NULL if the desired
|
||||||
* directory cannot be found.
|
* directory cannot be found.
|
||||||
*/
|
*/
|
||||||
static struct ref_entry *search_for_subdir(struct ref_dir *dir,
|
static struct ref_dir *search_for_subdir(struct ref_dir *dir,
|
||||||
const char *subdirname, int mkdir)
|
const char *subdirname, int mkdir)
|
||||||
{
|
{
|
||||||
struct ref_entry *entry = search_ref_dir(dir, subdirname);
|
struct ref_entry *entry = search_ref_dir(dir, subdirname);
|
||||||
|
@ -299,8 +299,7 @@ static struct ref_entry *search_for_subdir(struct ref_dir *dir,
|
||||||
entry = create_dir_entry(subdirname);
|
entry = create_dir_entry(subdirname);
|
||||||
add_entry_to_dir(dir, entry);
|
add_entry_to_dir(dir, entry);
|
||||||
}
|
}
|
||||||
assert(entry->flag & REF_DIR);
|
return get_ref_dir(entry);
|
||||||
return entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -319,14 +318,14 @@ static struct ref_dir *find_containing_dir(struct ref_dir *dir,
|
||||||
const char *slash;
|
const char *slash;
|
||||||
strbuf_init(&dirname, PATH_MAX);
|
strbuf_init(&dirname, PATH_MAX);
|
||||||
for (slash = strchr(refname, '/'); slash; slash = strchr(slash + 1, '/')) {
|
for (slash = strchr(refname, '/'); slash; slash = strchr(slash + 1, '/')) {
|
||||||
struct ref_entry *entry;
|
struct ref_dir *subdir;
|
||||||
strbuf_add(&dirname,
|
strbuf_add(&dirname,
|
||||||
refname + dirname.len,
|
refname + dirname.len,
|
||||||
(slash + 1) - (refname + dirname.len));
|
(slash + 1) - (refname + dirname.len));
|
||||||
entry = search_for_subdir(dir, dirname.buf, mkdir);
|
subdir = search_for_subdir(dir, dirname.buf, mkdir);
|
||||||
if (!entry)
|
if (!subdir)
|
||||||
break;
|
break;
|
||||||
dir = get_ref_dir(entry);
|
dir = subdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_release(&dirname);
|
strbuf_release(&dirname);
|
||||||
|
@ -819,7 +818,7 @@ static void read_loose_refs(struct ref_cache *refs, const char *dirname,
|
||||||
} else if (S_ISDIR(st.st_mode)) {
|
} else if (S_ISDIR(st.st_mode)) {
|
||||||
strbuf_addch(&refname, '/');
|
strbuf_addch(&refname, '/');
|
||||||
read_loose_refs(refs, refname.buf,
|
read_loose_refs(refs, refname.buf,
|
||||||
get_ref_dir(search_for_subdir(dir, refname.buf, 1)));
|
search_for_subdir(dir, refname.buf, 1));
|
||||||
} else {
|
} else {
|
||||||
if (*refs->name) {
|
if (*refs->name) {
|
||||||
hashclr(sha1);
|
hashclr(sha1);
|
||||||
|
@ -846,8 +845,8 @@ static struct ref_dir *get_loose_refs(struct ref_cache *refs)
|
||||||
if (!refs->loose) {
|
if (!refs->loose) {
|
||||||
refs->loose = create_dir_entry("");
|
refs->loose = create_dir_entry("");
|
||||||
read_loose_refs(refs, "refs/",
|
read_loose_refs(refs, "refs/",
|
||||||
get_ref_dir(search_for_subdir(get_ref_dir(refs->loose),
|
search_for_subdir(get_ref_dir(refs->loose),
|
||||||
"refs/", 1)));
|
"refs/", 1));
|
||||||
}
|
}
|
||||||
return get_ref_dir(refs->loose);
|
return get_ref_dir(refs->loose);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue