free(to_free);
return NULL;
}
- for (; *list; list++)
- if (!fspathcmp(path, real_path((*list)->path)))
+ for (; *list; list++) {
+ const char *wt_path = real_path_if_valid((*list)->path);
+
+ if (wt_path && !fspathcmp(path, wt_path))
break;
+ }
free(path);
free(to_free);
return *list;
DIR *dir;
struct dirent *d;
int ret = 0;
- struct repository_format format;
+ struct repository_format format = REPOSITORY_FORMAT_INIT;
submodule_gitdir = git_pathdup_submodule(path, "%s", "");
if (!submodule_gitdir)
read_repository_format(&format, sb.buf);
if (format.version != 0) {
strbuf_release(&sb);
+ clear_repository_format(&format);
return 1;
}
+ clear_repository_format(&format);
/* Replace config by worktrees. */
strbuf_setlen(&sb, sb.len - strlen("config"));