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.
Commit
b89bd70a3d091ebed76f5711d1a5d87f05f534f59fe7b7f172e203e7c9faff8d
Parent
fac7c2bac95b803…
1 file changed
+8
-3
+8
-3
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -1706,13 +1706,18 @@ | ||
| 1706 | 1706 | db_step(&q); |
| 1707 | 1707 | db_finalize(&q); |
| 1708 | 1708 | } |
| 1709 | 1709 | db_commit_transaction(); |
| 1710 | 1710 | |
| 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"; | |
| 1714 | 1719 | gitmirror_message(VERB_NORMAL, "%s\n", zRepack); |
| 1715 | 1720 | fossil_system(zRepack); |
| 1716 | 1721 | } |
| 1717 | 1722 | |
| 1718 | 1723 | /* Optionally do a "git push" */ |
| 1719 | 1724 |
| --- 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 |