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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Dec 12, 2011 at 06:38 UTC
3b12482358e58d95d4a8effc840862c87d995c4c
1 file changed
+9
-9
refs.c
+9
-9
@@ -298,14 +298,14 @@ static struct ref_array *get_packed_refs(struct ref_cache *refs)
298
return &refs->packed;
299
}
300
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,
302
struct ref_array *array)
303
{
304
DIR *dir;
305
const char *path;
306
307
- if (*submodule)
308
- path = git_path_submodule(submodule, "%s", base);
307
+ if (*refs->name)
308
+ path = git_path_submodule(refs->name, "%s", base);
309
else
310
path = git_path("%s", base);
311
@@ -336,19 +336,19 @@ static void get_ref_dir(const char *submodule, const char *base,
336
if (has_extension(de->d_name, ".lock"))
337
continue;
338
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)
341
: git_path("%s", refname);
342
if (stat(refdir, &st) < 0)
343
continue;
344
if (S_ISDIR(st.st_mode)) {
345
- get_ref_dir(submodule, refname, array);
345
+ get_ref_dir(refs, refname, array);
346
continue;
347
}
348
- if (submodule) {
348
+ if (*refs->name) {
349
hashclr(sha1);
350
flag = 0;
351
- if (resolve_gitlink_ref(submodule, refname, sha1) < 0) {
351
+ if (resolve_gitlink_ref(refs->name, refname, sha1) < 0) {
352
hashclr(sha1);
353
flag |= REF_ISBROKEN;
354
}
@@ -400,7 +400,7 @@ void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname)
400
static struct ref_array *get_loose_refs(struct ref_cache *refs)
401
{
402
if (!refs->did_loose) {
403
- get_ref_dir(refs->name, "refs", &refs->loose);
403
+ get_ref_dir(refs, "refs", &refs->loose);
404
sort_ref_array(&refs->loose);
405
refs->did_loose = 1;
406
}