Skip to content

Commit 69a3c76

Browse files
committed
refdb_fs: don't crash when the repo doesn't have a path
1 parent 4def703 commit 69a3c76

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/refdb_fs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ static int packed_load(refdb_fs_backend *backend)
181181
GITERR_CHECK_ALLOC(ref_cache->packfile);
182182
}
183183

184+
if (backend->path == NULL)
185+
return 0;
186+
184187
result = reference_read(&packfile, &ref_cache->packfile_time,
185188
backend->path, GIT_PACKEDREFS_FILE, &updated);
186189

@@ -1150,6 +1153,10 @@ static int setup_namespace(git_buf *path, git_repository *repo)
11501153
{
11511154
char *parts, *start, *end;
11521155

1156+
/* Not all repositories have a path */
1157+
if (repo->path_repository == NULL)
1158+
return 0;
1159+
11531160
/* Load the path to the repo first */
11541161
git_buf_puts(path, repo->path_repository);
11551162

0 commit comments

Comments
 (0)