pack: move install_packed_git()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Tan committed Aug 18, 2017 at 15:20 UTC e65f186242ccda24616e40681f46ad8d33da63e2
4 files changed +12 -11
cache.h
-1
@@ -1613,7 +1613,6 @@ extern void (*report_garbage)(unsigned seen_bits, const char *path);
1613
1614 extern void prepare_packed_git(void);
1615 extern void reprepare_packed_git(void);
1616 -extern void install_packed_git(struct packed_git *pack);
1616
1617 /*
1618 * Give a rough count of objects in the repository. This sacrifices accuracy
packfile.c
+10 -1
@@ -28,7 +28,7 @@ static unsigned int pack_used_ctr;
28 static unsigned int pack_mmap_calls;
29 static unsigned int peak_pack_open_windows;
30 static unsigned int pack_open_windows;
31 -unsigned int pack_open_fds;
31 +static unsigned int pack_open_fds;
32 static unsigned int pack_max_fds;
33 static size_t peak_pack_mapped;
34 static size_t pack_mapped;
@@ -658,3 +658,12 @@ struct packed_git *add_packed_git(const char *path, size_t path_len, int local)
658 hashclr(p->sha1);
659 return p;
660 }
661 +
662 +void install_packed_git(struct packed_git *pack)
663 +{
664 + if (pack->pack_fd != -1)
665 + pack_open_fds++;
666 +
667 + pack->next = packed_git;
668 + packed_git = pack;
669 +}
packfile.h
+2
@@ -28,6 +28,8 @@ extern unsigned int pack_open_fds;
28
29 extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path);
30
31 +extern void install_packed_git(struct packed_git *pack);
32 +
33 extern void pack_report(void);
34
35 /*
sha1_file.c
-9
@@ -719,15 +719,6 @@ void *xmmap(void *start, size_t length,
719 return ret;
720 }
721
722 -void install_packed_git(struct packed_git *pack)
723 -{
724 - if (pack->pack_fd != -1)
725 - pack_open_fds++;
726 -
727 - pack->next = packed_git;
728 - packed_git = pack;
729 -}
730 -
722 void (*report_garbage)(unsigned seen_bits, const char *path);
723
724 static void report_helper(const struct string_list *list,