Skip to content

Commit

Permalink
get_ref_dir(): change signature
Browse files Browse the repository at this point in the history
Change get_ref_dir() to take a (struct ref_cache *) in place of the
submodule name.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Dec 12, 2011
1 parent 316b097 commit 3b12482
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,14 @@ static struct ref_array *get_packed_refs(struct ref_cache *refs)
return &refs->packed;
}

static void get_ref_dir(const char *submodule, const char *base,
static void get_ref_dir(struct ref_cache *refs, const char *base,
struct ref_array *array)
{
DIR *dir;
const char *path;

if (*submodule)
path = git_path_submodule(submodule, "%s", base);
if (*refs->name)
path = git_path_submodule(refs->name, "%s", base);
else
path = git_path("%s", base);

Expand Down Expand Up @@ -336,19 +336,19 @@ static void get_ref_dir(const char *submodule, const char *base,
if (has_extension(de->d_name, ".lock"))
continue;
memcpy(refname + baselen, de->d_name, namelen+1);
refdir = submodule
? git_path_submodule(submodule, "%s", refname)
refdir = *refs->name
? git_path_submodule(refs->name, "%s", refname)
: git_path("%s", refname);
if (stat(refdir, &st) < 0)
continue;
if (S_ISDIR(st.st_mode)) {
get_ref_dir(submodule, refname, array);
get_ref_dir(refs, refname, array);
continue;
}
if (submodule) {
if (*refs->name) {
hashclr(sha1);
flag = 0;
if (resolve_gitlink_ref(submodule, refname, sha1) < 0) {
if (resolve_gitlink_ref(refs->name, refname, sha1) < 0) {
hashclr(sha1);
flag |= REF_ISBROKEN;
}
Expand Down Expand Up @@ -400,7 +400,7 @@ void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname)
static struct ref_array *get_loose_refs(struct ref_cache *refs)
{
if (!refs->did_loose) {
get_ref_dir(refs->name, "refs", &refs->loose);
get_ref_dir(refs, "refs", &refs->loose);
sort_ref_array(&refs->loose);
refs->did_loose = 1;
}
Expand Down

0 comments on commit 3b12482

Please sign in to comment.