refdb_fs: don't crash when the repo doesn't have a path

This commit is contained in:
Carlos Martín Nieto 2013-05-04 15:03:32 +02:00
parent 4def7035ca
commit 69a3c766b6

View File

@ -181,6 +181,9 @@ static int packed_load(refdb_fs_backend *backend)
GITERR_CHECK_ALLOC(ref_cache->packfile);
}
if (backend->path == NULL)
return 0;
result = reference_read(&packfile, &ref_cache->packfile_time,
backend->path, GIT_PACKEDREFS_FILE, &updated);
@ -1150,6 +1153,10 @@ static int setup_namespace(git_buf *path, git_repository *repo)
{
char *parts, *start, *end;
/* Not all repositories have a path */
if (repo->path_repository == NULL)
return 0;
/* Load the path to the repo first */
git_buf_puts(path, repo->path_repository);