git usage

View: New views
2 Messages — Rating Filter:   Alert me  

git usage

by Karl Berry :: Rate this Message:

| View Threaded | Show Only this Message

ttn,

Savannah now has a monthly cron job that does some git maintenance on
all repos (thanks to Jim Meyering).  Does this suffice for your needs?

kb

vcs# cat /root/infra/git-gc-all-repos
[...]

date; echo 'running du w/cold cache takes a while...'; du -sh .
for dir in $(find . -type d -maxdepth 2 -name '*.git'|sort); 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 -q
  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
date; du -sh .


Re: git usage

by Thien-Thi Nguyen-6 :: Rate this Message:

| View Threaded | Show Only this Message

() karl@... (Karl Berry)
() Sat, 4 Aug 2012 22:24:59 GMT

   Savannah now has a monthly cron job that does some git maintenance
   on all repos (thanks to Jim Meyering).  Does this suffice for your
   needs?

   [script]

Yes, partially (one of two) -- thanks!

(In June, i had somehow pushed an entirely separate dag into the ‘rcs’
repo (from a private repo).  As a result, ‘git fsck --root’ showed two
lines, and of course, the private dag was accessible if one could guess
a valid commit id (SHA1).  The fix is to remove all references and gc.
I did the former immediately, w/in 5 minutes of discovering the error,
and it looks to me that the script does the latter.  I confirm that a
cgit (web) probe now yields "Bad object id", as expected.  Cool!)

The other need (two of two), i will address in the other thread.

--
Thien-Thi Nguyen ..................................... GPG key: 4C807502
.                  NB: ttn at glug dot org is not me                   .
.                 (and has not been since 2007 or so)                  .
.                        ACCEPT NO SUBSTITUTES                         .
........... please send technical questions to mailing lists ...........


attachment0 (203 bytes) Download Attachment