Skip to content

Commit 3b12482

Browse files
mhaggergitster
authored andcommitted
get_ref_dir(): change signature
Change get_ref_dir() to take a (struct ref_cache *) in place of the submodule name. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 316b097 commit 3b12482

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

refs.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,14 @@ static struct ref_array *get_packed_refs(struct ref_cache *refs)
298298
return &refs->packed;
299299
}
300300

301-
static void get_ref_dir(const char *submodule, const char *base,
301+
static void get_ref_dir(struct ref_cache *refs, const char *base,
302302
struct ref_array *array)
303303
{
304304
DIR *dir;
305305
const char *path;
306306

307-
if (*submodule)
308-
path = git_path_submodule(submodule, "%s", base);
307+
if (*refs->name)
308+
path = git_path_submodule(refs->name, "%s", base);
309309
else
310310
path = git_path("%s", base);
311311

@@ -336,19 +336,19 @@ static void get_ref_dir(const char *submodule, const char *base,
336336
if (has_extension(de->d_name, ".lock"))
337337
continue;
338338
memcpy(refname + baselen, de->d_name, namelen+1);
339-
refdir = submodule
340-
? git_path_submodule(submodule, "%s", refname)
339+
refdir = *refs->name
340+
? git_path_submodule(refs->name, "%s", refname)
341341
: git_path("%s", refname);
342342
if (stat(refdir, &st) < 0)
343343
continue;
344344
if (S_ISDIR(st.st_mode)) {
345-
get_ref_dir(submodule, refname, array);
345+
get_ref_dir(refs, refname, array);
346346
continue;
347347
}
348-
if (submodule) {
348+
if (*refs->name) {
349349
hashclr(sha1);
350350
flag = 0;
351-
if (resolve_gitlink_ref(submodule, refname, sha1) < 0) {
351+
if (resolve_gitlink_ref(refs->name, refname, sha1) < 0) {
352352
hashclr(sha1);
353353
flag |= REF_ISBROKEN;
354354
}
@@ -400,7 +400,7 @@ void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname)
400400
static struct ref_array *get_loose_refs(struct ref_cache *refs)
401401
{
402402
if (!refs->did_loose) {
403-
get_ref_dir(refs->name, "refs", &refs->loose);
403+
get_ref_dir(refs, "refs", &refs->loose);
404404
sort_ref_array(&refs->loose);
405405
refs->did_loose = 1;
406406
}

0 commit comments

Comments
 (0)