[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Savannah-hackers-public] FYI, ran "git gc" on all git repositories

From: Sylvain Beucler
Subject: Re: [Savannah-hackers-public] FYI, ran "git gc" on all git repositories
Date: Fri, 9 Oct 2009 19:31:30 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Fri, Oct 09, 2009 at 04:27:32PM +0200, Jim Meyering wrote:
> I did the same thing a few months ago.
> For some it made a big difference: emacs.git went from 1.1GB to 155MB.
> Active repositories were shrunk to ~20% or even 5% of their original size.
> This is the script I ran:
> #!/bin/bash
> log=$(mktemp /tmp/log-repo-gc-XXXXXX)
> printf "Run this to see more detail:\ntail -f $log\n"
> exec >$log
> cd /vservers/vcs-noshell/srv/git
> for dir in *.git; do
>   echo $dir... 1>&2
>   start_kb=$(du -sk $dir|cut -f1)
>   printf '%-20s %u KiB->' $dir $start_kb
>   start_sec=$(date +%s)
>   git --git-dir=$dir gc
>   end_sec=$(date +%s)
>   elapsed=$((end_sec - start_sec))
>   end_kb=$(du -sk $dir|cut -f1)
>   percent_saved=$(echo "scale=2; 100 * ($start_kb - $end_kb) / $start_kb"|bc)
>   printf '%s (saved %s%% in %ss)\n' $end_kb $percent_saved $elapsed
> done

Cool.  Nice optimization.

I wonder what kind of effects this have though.

Possibly HTTP users will have to download a big file (but then
shouldn't use http ;))

We should ask Petr Baudis from, I think there's been a
discussion a year or two ago, and they weren't sure -- or fix git into
doing it automatically if that's feasible.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]