Although I converted upstream coreutils to git last month, I just
reconverted coreutils once again, as a test, and ended up with a
git repository of about 130MB (contrast with my packed git repo of
size 52MB). That was because there were a lot of commits (but < 1024)
after the final automatic "git-repack -a -d".
Running a final
git-repack -a -d && git-prune-packed
cut the final repository size down to the expected size.
So this looks like an easy way to improve git-cvsimport.
Just run "git repack ..." at the end if there's more than
some reasonable amount of not-packed data.
My choice of 1MB is a little arbitrarily. I wouldn't mind missing
the minimal repo size by 1MB. At the other end of the spectrum,
it's probably not worthwhile to pack everything when the total
repository size is less than 1MB.
Here's the patch:
Signed-off-by: Jim Meyering <jim@meyering.net>
---
git-cvsimport.perl | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 14e2c61..b54a948 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -876,6 +876,16 @@ while(<CVS>) {
}
commit() if $branch and $state != 11;
+# The heuristic of repacking every 1024 commits can leave a
+# lot of unpacked data. If there is more than 1MB worth of
+# not-packed objects, repack once more.
+my $line = `git-count-objects`;
+if ($line =~ /^(\d+) objects, (\d+) kilobytes$/) {
+ my ($n_objects, $kb) = ($1, $2);
+ 1024 < $kb
+ and system("git repack -a -d");
+}
+
foreach my $git_index (values %index) {
if ($git_index ne '.git/index') {
unlink($git_index);
--
1.4.4.rc2.g2a543
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Mikulas Patocka | LFENCE instruction (was: [rfc][patch 3/3] x86: optimise barriers) |
| Daniel J Blueman | time for TCP ECN defaulting to on? |
| Renato S. Yamane | Error -71 on device descriptor read/all |
| Zdenek Kabelac | Suspend to memory is freezing my machine |
git: | |
| Abdelrazak Younes | Git-windows and git-svn? |
| Giuseppe Bilotta | Re: gitweb and remote branches |
| Petr Baudis | repo.or.cz wishes? |
| Josh England | Re: cloning/pulling hooks |
| Reyk Floeter | Re: Real men don't attack straw men |
| Alexey Suslikov | OT: OpenBSD on Asus eeePC |
| Jernej Makovsek | How secure is OpenBSD really |
| Girish Venkatachalam | Ethernet jumbo frames? |
| Kim Phillips | [PATCH 0/5] fixups for mpc8360 rev. 2.1 erratum #2 (RGMII Timing) |
| Michael Grollman | Re: 8169 Intermittent ifup Failure Issue With RTL8102E Chipset in Intel's New D945... |
| Gerrit Renker | [PATCH 5/5] dccp: Tidy up setsockopt calls |
| Jeff Garzik | Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
