*accept_windows_inuse = has_windows_inuse;
}
-static int close_one_pack(void)
+static int close_one_pack(struct repository *r)
{
struct packed_git *p, *lru_p = NULL;
struct pack_window *mru_w = NULL;
int accept_windows_inuse = 1;
- for (p = the_repository->objects->packed_git; p; p = p->next) {
+ for (p = r->objects->packed_git; p; p = p->next) {
if (p->pack_fd == -1)
continue;
find_lru_pack(p, &lru_p, &mru_w, &accept_windows_inuse);
pack_max_fds = 1;
}
- while (pack_max_fds <= pack_open_fds && close_one_pack())
+ while (pack_max_fds <= pack_open_fds && close_one_pack(p->repo))
; /* nothing */
p->pack_fd = git_open(p->pack_name);
return -1;
}
-static int in_window(struct pack_window *win, off_t offset)
+static int in_window(struct repository *r, struct pack_window *win,
+ off_t offset)
{
/* We must promise at least one full hash after the
* offset is available from this window, otherwise the offset
*/
off_t win_off = win->offset;
return win_off <= offset
- && (offset + the_hash_algo->rawsz) <= (win_off + win->len);
+ && (offset + r->hash_algo->rawsz) <= (win_off + win->len);
}
unsigned char *use_pack(struct packed_git *p,
if (offset < 0)
die(_("offset before end of packfile (broken .idx?)"));
- if (!win || !in_window(win, offset)) {
+ if (!win || !in_window(p->repo, win, offset)) {
if (win)
win->inuse_cnt--;
for (win = p->windows; win; win = win->next) {
- if (in_window(win, offset))
+ if (in_window(p->repo, win, offset))
break;
}
if (!win) {