git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Confused about `git gc`
@ 2009-06-09  8:28 Yakup Akbay
  2009-06-09 10:45 ` Jakub Narebski
  0 siblings, 1 reply; 3+ messages in thread
From: Yakup Akbay @ 2009-06-09  8:28 UTC (permalink / raw)
  To: git

Looks like I didn't quite understand the actual role of `git gc`. I just 
thought that `git gc` would remove all unreferenced objects during the 
unpack-pack process. However, I'm not seeing the result what I was 
expecting from `git gc`.

I'm adding an object into the database, which is ignored by git. Then I 
expect the object to be removed after `git gc`. But, it's still there.

Please follow:

$ echo "/ignored_file" > .gitignore
$ echo "This file is ignored by git. I'm sure that this content has 
never been existed in the repository before." > ignored_file
$ git hash-object -w ignored_file
39cd40a92c0a92bbcbd74ec6879b4936212beebd
$ ls .git/objects/
07  39  9f  b9  d0  fa  info  pack
$ ls .git/objects/39/
cd40a92c0a92bbcbd74ec6879b4936212beebd
$ git gc
Counting objects: 319, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (147/147), done.
Writing objects: 100% (319/319), done.
Total 319 (delta 124), reused 319 (delta 124)
$ ls .git/objects/39/
cd40a92c0a92bbcbd74ec6879b4936212beebd


As you see, 39cd40a92c0a92bbcbd74ec6879b4936212beebd is still there. 
Shouldn't it be removed by `git gc`?

What am I overlooking?


Regards,
Yakup

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

* Re: Confused about `git gc`
  2009-06-09  8:28 Confused about `git gc` Yakup Akbay
@ 2009-06-09 10:45 ` Jakub Narebski
  2009-06-09 11:18   ` Yakup Akbay
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Narebski @ 2009-06-09 10:45 UTC (permalink / raw)
  To: Yakup Akbay; +Cc: git

Yakup Akbay <yakbay@ubicom.com> writes:

> Looks like I didn't quite understand the actual role of `git gc`. I
> just thought that `git gc` would remove all unreferenced objects
> during the unpack-pack process. However, I'm not seeing the result
> what I was expecting from `git gc`.
> 
> I'm adding an object into the database, which is ignored by git. Then
> I expect the object to be removed after `git gc`. But, it's still
> there.

[...]
> What am I overlooking?

You are probably overlooking the safety introduced to "git gc" to make
it safer against concurrently run git operations, namely the fact that
it would not remove new loose objects (it would remove loose objects
only when they are old enough).

-- 
Jakub Narebski
Poland
ShadeHawk on #git

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

* Re: Confused about `git gc`
  2009-06-09 10:45 ` Jakub Narebski
@ 2009-06-09 11:18   ` Yakup Akbay
  0 siblings, 0 replies; 3+ messages in thread
From: Yakup Akbay @ 2009-06-09 11:18 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski wrote:
> Yakup Akbay <yakbay@ubicom.com> writes:
>
>   
>> Looks like I didn't quite understand the actual role of `git gc`. I
>> just thought that `git gc` would remove all unreferenced objects
>> during the unpack-pack process. However, I'm not seeing the result
>> what I was expecting from `git gc`.
>>
>> I'm adding an object into the database, which is ignored by git. Then
>> I expect the object to be removed after `git gc`. But, it's still
>> there.
>>     
>
> [...]
>   
>> What am I overlooking?
>>     
>
> You are probably overlooking the safety introduced to "git gc" to make
> it safer against concurrently run git operations, namely the fact that
> it would not remove new loose objects (it would remove loose objects
> only when they are old enough).
>
>   
Hmm, I see.

    git gc --prune=<date>

helped me remove all loose objects.


Thanks,
Yakup

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

end of thread, other threads:[~2009-06-09 11:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-09  8:28 Confused about `git gc` Yakup Akbay
2009-06-09 10:45 ` Jakub Narebski
2009-06-09 11:18   ` Yakup Akbay

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).