Fossil SCM

Repack a new git mirror, and any git mirror with more than 20 packs. The inefficient "git fast format" packs accumulate and, if not repacked, the mirror becomes enormous. Note --keep-unreachable is essential. nodes that a particular pack doesn't know about.

danshearer 2026-10-26 19:28 UTC trunk
Commit b89bd70a3d091ebed76f5711d1a5d87f05f534f59fe7b7f172e203e7c9faff8d
1 file changed +8 -3
+8 -3
--- src/export.c
+++ src/export.c
@@ -1706,13 +1706,18 @@
17061706
db_step(&q);
17071707
db_finalize(&q);
17081708
}
17091709
db_commit_transaction();
17101710
1711
- /* Maybe run a git repack */
1712
- if( bNeedRepack ){
1713
- const char *zRepack = "git repack -adf";
1711
+ /* Repack a new mirror, and any mirror with more than 20 packs. Each
1712
+ ** "git fast-import" run adds an inefficient pack (that's why its fast)
1713
+ ** so we need to regularly repack otherwise the mirror becomes huge.
1714
+ */
1715
+ if( bNeedRepack
1716
+ || file_directory_list(".git/objects/pack", "*.pack", 0, 0, 0)>20
1717
+ ){
1718
+ const char *zRepack = "git repack -adf --keep-unreachable";
17141719
gitmirror_message(VERB_NORMAL, "%s\n", zRepack);
17151720
fossil_system(zRepack);
17161721
}
17171722
17181723
/* Optionally do a "git push" */
17191724
--- src/export.c
+++ src/export.c
@@ -1706,13 +1706,18 @@
1706 db_step(&q);
1707 db_finalize(&q);
1708 }
1709 db_commit_transaction();
1710
1711 /* Maybe run a git repack */
1712 if( bNeedRepack ){
1713 const char *zRepack = "git repack -adf";
 
 
 
 
 
1714 gitmirror_message(VERB_NORMAL, "%s\n", zRepack);
1715 fossil_system(zRepack);
1716 }
1717
1718 /* Optionally do a "git push" */
1719
--- src/export.c
+++ src/export.c
@@ -1706,13 +1706,18 @@
1706 db_step(&q);
1707 db_finalize(&q);
1708 }
1709 db_commit_transaction();
1710
1711 /* Repack a new mirror, and any mirror with more than 20 packs. Each
1712 ** "git fast-import" run adds an inefficient pack (that's why its fast)
1713 ** so we need to regularly repack otherwise the mirror becomes huge.
1714 */
1715 if( bNeedRepack
1716 || file_directory_list(".git/objects/pack", "*.pack", 0, 0, 0)>20
1717 ){
1718 const char *zRepack = "git repack -adf --keep-unreachable";
1719 gitmirror_message(VERB_NORMAL, "%s\n", zRepack);
1720 fossil_system(zRepack);
1721 }
1722
1723 /* Optionally do a "git push" */
1724

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button