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