diff options
| author | Alan Rogers <alan@github.com> | 2014-07-22 15:08:24 +1000 |
|---|---|---|
| committer | Alan Rogers <alan@github.com> | 2014-07-22 15:08:24 +1000 |
| commit | 7d0ab0fae04015e0bc66ff16beae495f13969b10 (patch) | |
| tree | 09323e451046ef9dfa6f83754c3fe1fb3d327b48 /src/pack.c | |
| parent | e824e63de6724557946ba155034ff8c864f594d2 (diff) | |
| parent | 091165c53b2bcd5d41fb71d43ed5a23a3d96bf5d (diff) | |
| download | libgit2-7d0ab0fae04015e0bc66ff16beae495f13969b10.tar.gz | |
Merge remote-tracking branch 'origin/master' into fix-git-status-list-new-unreadable-folder
Diffstat (limited to 'src/pack.c')
| -rw-r--r-- | src/pack.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/pack.c b/src/pack.c index ace7abb58..22dbd5647 100644 --- a/src/pack.c +++ b/src/pack.c @@ -968,10 +968,10 @@ void git_packfile_free(struct git_pack_file *p) cache_free(&p->bases); - git_mwindow_free_all(&p->mwf); - - if (p->mwf.fd >= 0) + if (p->mwf.fd >= 0) { + git_mwindow_free_all_locked(&p->mwf); p_close(p->mwf.fd); + } pack_index_free(p); @@ -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; |
