git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* delete deprecated refs to release disk space
@ 2011-11-13 15:10 Peter Vereshagin
  2011-11-13 17:01 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Vereshagin @ 2011-11-13 15:10 UTC (permalink / raw
  To: git

Hello.

I use git for sql database backups:

    http://gitweb.vereshagin.org/endvance/blob_plain/HEAD:/endvance/README

Am wondering if there is a way to remove the expired revisions? Following that
scenario:

    https://gist.github.com/1362183

I think there should be the way to decrease the space that .git takes. Without
compression, of course.

No problem if this involves the overwriting of the history like  filter-branch
does.  But filter-branch doesn't seem to be able to remove the old  info  from
repository based on expiration time, does it?

Thank you.

--
Peter Vereshagin <peter@vereshagin.org> (http://vereshagin.org) pgp: A0E26627 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: delete deprecated refs to release disk space
  2011-11-13 15:10 delete deprecated refs to release disk space Peter Vereshagin
@ 2011-11-13 17:01 ` Ævar Arnfjörð Bjarmason
  2011-11-14 14:25   ` Peter Vereshagin
  0 siblings, 1 reply; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2011-11-13 17:01 UTC (permalink / raw
  To: Peter Vereshagin; +Cc: git

2011/11/13 Peter Vereshagin <peter@vereshagin.org>:
> Hello.
>
> I use git for sql database backups:
>
>    http://gitweb.vereshagin.org/endvance/blob_plain/HEAD:/endvance/README
>
> Am wondering if there is a way to remove the expired revisions? Following that
> scenario:
>
>    https://gist.github.com/1362183
>
> I think there should be the way to decrease the space that .git takes. Without
> compression, of course.
>
> No problem if this involves the overwriting of the history like  filter-branch
> does.  But filter-branch doesn't seem to be able to remove the old  info  from
> repository based on expiration time, does it?

What you're looking for is git-filter-branch + the graft facility. I
can't remember the exact invocation, but you echo the sha1 of the
commit you want to be the oldest commit to .git/info/grafts, then run
git-filter-branch.

You can use whatever you like to discover that sha1, e.g. keep N
revisions (which might be committed once per day) around, or have some
custom time limit etc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: delete deprecated refs to release disk space
  2011-11-13 17:01 ` Ævar Arnfjörð Bjarmason
@ 2011-11-14 14:25   ` Peter Vereshagin
  2011-11-16 23:44     ` Peter Vereshagin
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Vereshagin @ 2011-11-14 14:25 UTC (permalink / raw
  To: ??var Arnfj??r?? Bjarmason; +Cc: Peter Vereshagin, git

Hello.

2011/11/13 18:01:18 +0100 ??var Arnfj??r?? Bjarmason <avarab@gmail.com> => To Peter Vereshagin :
vArB> What you're looking for is git-filter-branch + the graft facility. I
vArB> can't remember the exact invocation, but you echo the sha1 of the
vArB> commit you want to be the oldest commit to .git/info/grafts, then run
vArB> git-filter-branch.

Seem to work for me ( with 'gc' and 'prune' thereafter ) but with these quirks:
*) the git-filter-branch(1) tells that there must be two ids:

    echo "$commit-id $graft-id" >> .git/info/grafts

This works for me if only one is put there.
*) I'd like to have a command for this. Is this a '--parent-filter' to make
the same thing?

N commits ago is a fine setting for me as it's a cron job backup. Thanks?

--
Peter Vereshagin <peter@vereshagin.org> (http://vereshagin.org) pgp: A0E26627 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: delete deprecated refs to release disk space
  2011-11-14 14:25   ` Peter Vereshagin
@ 2011-11-16 23:44     ` Peter Vereshagin
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Vereshagin @ 2011-11-16 23:44 UTC (permalink / raw
  To: git; +Cc: ??var Arnfj??r?? Bjarmason, git

Hello.

2011/11/14 18:25:25 +0400 Peter Vereshagin <peter@vereshagin.org> => To ??var Arnfj??r?? Bjarmason :
PV> N commits ago is a fine setting for me as it's a cron job backup. Thanks?

* = Thanks!

Here is the PoC QnD code that releases disk space for me by far:

    git rev-list --all --timestamp |\
        perl -Mstrict -MTime::ParseDate -wE \
            'my $match = 0; my $expire = parsedate( "3 days ago" ); while (<>)
                { chomp; my ( $tstamp => $graft_id ) = split /\s+/;
                    if ( not( $match ) and $tstamp < $expire )
                        { say $graft_id; $match = 1; } }
            ' > .git/info/grafts && \
    git filter-branch -f

for case a one shall seek for it.

--
Peter Vereshagin <peter@vereshagin.org> (http://vereshagin.org) pgp: A0E26627 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-16 23:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-13 15:10 delete deprecated refs to release disk space Peter Vereshagin
2011-11-13 17:01 ` Ævar Arnfjörð Bjarmason
2011-11-14 14:25   ` Peter Vereshagin
2011-11-16 23:44     ` Peter Vereshagin

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).