简体   繁体   English

多个git packfile

[英]Multiple git packfiles

I would like to know if it is possible to have more than one pack file (and index) for the same repository. 我想知道同一存储库是否可以有多个打包文件(和索引)。 Some kind of accumulative pack file that just contains the differences since the last push for instance. 某种累积包文件,仅包含自上次推送以来的差异。

I'm seeing this in a custom implementation using git and I would like to know if it is something natural to git. 我在使用git的自定义实现中看到了这一点,我想知道git是否自然。

Kind regards 亲切的问候

As phd answered , Git will read multiple pack files (and pack index files). 正如phd回答的那样 ,Git 读取多个打包文件(和打包索引文件)。 Note, however, that each pack file is required to be fully self-contained: deltified object's bases for an object inside the pack must also be inside that same pack. 但是请注意,每个包文件都必须是完全独立的:包内对象的已删除对象基础也必须位于同一包内。 (For instance if the deltified representation of object 0123... says start with 4567... and make these changes , object 4567... must be in the same pack file.) This means that many small packs are likely to use more space than fewer larger packs. (例如,如果对象0123...的经过修饰的表示4567...开始并进行了这些更改 ,则对象4567...必须位于同一包文件中。)这意味着许多小包装可能使用更多的小包装空间比少一些的大包装少

Differences since the last push actually occur rather naturally, because git push over smart protocols work by having the two Gits converse to see which objects to transfer. 自上次推送以来的差异实际上是自然发生的,因为git push智能协议通过使两个Git进行交互以查看要传输的对象而起作用。 The sender then sends a thin pack , which deliberately violates the above rule—it will contain only the deltified objects and not their bases—which the receiver must "fatten" using git index-pack --fix-thin . 然后,发送方发送一个瘦包 ,该瘦包故意违反了以上规则-它仅包含经过删除的对象,而不包含它们的基础-接收者必须使用git index-pack --fix-thin If the receiver does that, and leaves the fattened, no-longer-thin pack in place, the receiver now has N+1 packs where the receiver used to have N packs. 如果接收器这样做了,并且将加肥的,不再变薄的包装留在原地,则该接收器现在将具有N + 1个包装,而接收器以前则具有N个包装。

You can limit packfiles by size setting pack.packSizeLimit . 您可以通过设置pack.packSizeLimit的大小来限制packfiles Reaching this limit git creates multiple packfiles. 达到此限制git会创建多个packfile。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM