[go: up one dir, main page]

Optimize forking with transactions

Forks are not handle differently from other repository creations with transactions and this leads to forking being fairly inefficient.

CreateFork calls repoutil.Create here, and repoutil.Create in turn creates a new pack without any unreachable objects to ensure new repositories uphold the guarantee that all object dependencies exist, and record the repository creation.

This has the problem that we're essentially performing a full repack every time we create fork which is expensive. It would be better to simply create the fork by recording a log entry that links the files from the original repository into the fork. That way the fork operation can only be a collection of hard link operations without having to copy the data.

To do this, we'd have change CreateFork to record the forking using hard links only without relying on the general path where we repack the objects.