|
1 | | -#define USE_THE_REPOSITORY_VARIABLE |
2 | 1 |
|
3 | 2 | #include "git-compat-util.h" |
4 | 3 | #include "environment.h" |
@@ -48,15 +47,15 @@ static size_t pack_mapped; |
48 | 47 | #define SZ_FMT PRIuMAX |
49 | 48 | static inline uintmax_t sz_fmt(size_t s) { return s; } |
50 | 49 |
|
51 | | -void pack_report(void) |
| 50 | +void pack_report(struct repository *repo) |
52 | 51 | { |
53 | 52 | fprintf(stderr, |
54 | 53 | "pack_report: getpagesize() = %10" SZ_FMT "\n" |
55 | 54 | "pack_report: core.packedGitWindowSize = %10" SZ_FMT "\n" |
56 | 55 | "pack_report: core.packedGitLimit = %10" SZ_FMT "\n", |
57 | 56 | sz_fmt(getpagesize()), |
58 | | - sz_fmt(packed_git_window_size), |
59 | | - sz_fmt(packed_git_limit)); |
| 57 | + sz_fmt(repo->settings.packed_git_window_size), |
| 58 | + sz_fmt(repo->settings.packed_git_limit)); |
60 | 59 | fprintf(stderr, |
61 | 60 | "pack_report: pack_used_ctr = %10u\n" |
62 | 61 | "pack_report: pack_mmap_calls = %10u\n" |
@@ -652,20 +651,28 @@ unsigned char *use_pack(struct packed_git *p, |
652 | 651 | break; |
653 | 652 | } |
654 | 653 | if (!win) { |
655 | | - size_t window_align = packed_git_window_size / 2; |
| 654 | + size_t window_align; |
656 | 655 | off_t len; |
| 656 | + struct repo_settings *settings; |
| 657 | + |
| 658 | + /* lazy load the settings in case it hasn't been setup */ |
| 659 | + prepare_repo_settings(p->repo); |
| 660 | + settings = &p->repo->settings; |
| 661 | + |
| 662 | + window_align = settings->packed_git_window_size / 2; |
657 | 663 |
|
658 | 664 | if (p->pack_fd == -1 && open_packed_git(p)) |
659 | 665 | die("packfile %s cannot be accessed", p->pack_name); |
660 | 666 |
|
661 | 667 | CALLOC_ARRAY(win, 1); |
662 | 668 | win->offset = (offset / window_align) * window_align; |
663 | 669 | len = p->pack_size - win->offset; |
664 | | - if (len > packed_git_window_size) |
665 | | - len = packed_git_window_size; |
| 670 | + if (len > settings->packed_git_window_size) |
| 671 | + len = settings->packed_git_window_size; |
666 | 672 | win->len = (size_t)len; |
667 | 673 | pack_mapped += win->len; |
668 | | - while (packed_git_limit < pack_mapped |
| 674 | + |
| 675 | + while (settings->packed_git_limit < pack_mapped |
669 | 676 | && unuse_one_window(p)) |
670 | 677 | ; /* nothing */ |
671 | 678 | win->base = xmmap_gently(NULL, win->len, |
|
0 commit comments