git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git gc == git garbage-create from removed branch
@ 2012-05-03 18:38 Hallvard Breien Furuseth
  2012-05-04  7:37 ` Andreas Ericsson
  0 siblings, 1 reply; 3+ messages in thread
From: Hallvard Breien Furuseth @ 2012-05-03 18:38 UTC (permalink / raw)
  To: git

After removing a branch, 'git gc' explodes all objects
which were only in that branch.  Git filled up my disk that
way when I had cherry-picked from a big remote repo and then
did git remote rm.  Tested with Git 1.7.10.1 and 1.7.1.

$ git clone --bare --branch linux-overhaul-20010122 \
	git://git.savannah.gnu.org/config.git
...
Receiving objects: 100% (3263/3263), 517.15 KiB | 295 KiB/s, done.
...
$ cd config.git/
$ git tag -d `git tag`
...
$ git branch -D master
$ git gc
Counting objects: 1183, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (751/751), done.
Writing objects: 100% (1183/1183), done.
Total 1183 (delta 457), reused 1113 (delta 393)

$ find objects/?? -type f -print | wc -l
2080

$ git reflog expire --expire=now; git gc --prune=now
Counting objects: 1183, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (687/687), done.
Writing objects: 100% (1183/1183), done.
Total 1183 (delta 457), reused 1183 (delta 457)

$ ls objects/
info/  pack/

3263 fetched objects == 2080 loose objects before prune +
HEAD's 1183 objects.

-- 
Hallvard

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

* Re: git gc == git garbage-create from removed branch
  2012-05-03 18:38 git gc == git garbage-create from removed branch Hallvard Breien Furuseth
@ 2012-05-04  7:37 ` Andreas Ericsson
  2012-05-04  8:58   ` Hallvard Breien Furuseth
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Ericsson @ 2012-05-04  7:37 UTC (permalink / raw)
  To: Hallvard Breien Furuseth; +Cc: git

On 05/03/2012 08:38 PM, Hallvard Breien Furuseth wrote:
> After removing a branch, 'git gc' explodes all objects
> which were only in that branch.  Git filled up my disk that
> way when I had cherry-picked from a big remote repo and then
> did git remote rm.  Tested with Git 1.7.10.1 and 1.7.1.
> 

That's by design. It's added to save people who accidentally
delete a branch or for some other reason really want to keep the
objects they're about to delete.

Use 'git gc --prune=now' with a recent* git and you'll avoid the
problem.

* Recent enough to include the patch that avoids writing out loose
objects when they would be auto-deleted by the following pruning.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

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

* Re: git gc == git garbage-create from removed branch
  2012-05-04  7:37 ` Andreas Ericsson
@ 2012-05-04  8:58   ` Hallvard Breien Furuseth
  0 siblings, 0 replies; 3+ messages in thread
From: Hallvard Breien Furuseth @ 2012-05-04  8:58 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: git

 On Fri, 04 May 2012 09:37:21 +0200, Andreas Ericsson <ae@op5.se> wrote:
> On 05/03/2012 08:38 PM, Hallvard Breien Furuseth wrote:
>> After removing a branch, 'git gc' explodes all objects
>> which were only in that branch.  Git filled up my disk that
>> way when I had cherry-picked from a big remote repo and then
>> did git remote rm.  Tested with Git 1.7.10.1 and 1.7.1.
>
> That's by design. It's added to save people who accidentally
> delete a branch or for some other reason really want to keep the
> objects they're about to delete.

 Keeping old objects for a while is by design, which I appreciate.

 Consuming gigabytes of disk space for this is a design bug.  Git should
 pack such objects when they breed too fast, just like other objects.

 If that's a hard design issue to get around, git gc should at least
 catch this and stop unless the user forces gc with some option.
 Users should not need to know that in certain circumstances, gc will
 ravenously eat their disk space without even giving advance notice.

> Use 'git gc --prune=now' with a recent* git and you'll avoid the
> problem.

 I don't want to prune.  Old objects have indeed saved me from
 accidents, as you mention.

 But it's good to know I don't need to throw away the reflog too.
 Thanks.

 Hallvard

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

end of thread, other threads:[~2012-05-04  8:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-03 18:38 git gc == git garbage-create from removed branch Hallvard Breien Furuseth
2012-05-04  7:37 ` Andreas Ericsson
2012-05-04  8:58   ` Hallvard Breien Furuseth

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 NNTP newsgroup(s).