Re: Question: How to execute git-gc correctly on the git server

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

 



Jeff King <peff@xxxxxxxx> 于2022年12月9日周五 09:37写道:
>
> On Fri, Dec 09, 2022 at 01:49:18AM +0100, Michal Suchánek wrote:
>
> > > In this case it's the mtime on the object file (or the pack containing
> > > it). But yes, it is far from a complete race-free solution.
> >
> > So if you are pushing a branch that happens to reuse commits or other
> > objects from an earlier branh that might have been collected ín the
> > meantime you are basically doomed.
>
> Basically yes. We do "freshen" the mtimes on object files when we omit
> an object write (e.g., your index state ends up at the same tree as an
> old one). But for a push, there is no freshening. We check the graph at
> the time of the push and decide if we have everything we need (either
> newly pushed, or from what we already had in the repo). And that is
> what's racy; somebody might be deleting as that check is happening.
>
> > People deleting a branch and then pushing another variant in which many
> > objects are the same is a risk.
> >
> > People exporting files from somewhere and adding them to the repo which
> > are bit-identical when independently exported by multiple people and
> > sometimes deleting branches is a risk.
>
> Yes, both of those are risky (along with many other variants).
>

I'm wondering if there's an easy and poor performance way to do
gc safely? For example, add a file lock to the repository during
git push and git gc?

> -Peff




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux