diff options
Diffstat (limited to 'src/pack.c')
-rw-r--r-- | src/pack.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/pack.c b/src/pack.c index ace7abb58..767efb6c3 100644 --- a/src/pack.c +++ b/src/pack.c @@ -968,7 +968,7 @@ void git_packfile_free(struct git_pack_file *p) cache_free(&p->bases); - git_mwindow_free_all(&p->mwf); + git_mwindow_free_all_locked(&p->mwf); if (p->mwf.fd >= 0) p_close(p->mwf.fd); @@ -1063,6 +1063,23 @@ cleanup: return -1; } +int git_packfile__name(char **out, const char *path) +{ + size_t path_len; + git_buf buf = GIT_BUF_INIT; + + path_len = strlen(path); + + if (path_len < strlen(".idx")) + return git_odb__error_notfound("invalid packfile path", NULL); + + if (git_buf_printf(&buf, "%.*s.pack", (int)(path_len - strlen(".idx")), path) < 0) + return -1; + + *out = git_buf_detach(&buf); + return 0; +} + int git_packfile_alloc(struct git_pack_file **pack_out, const char *path) { struct stat st; |