Skip to content

Split 'internal/git' package

Sami Hiltunen requested to merge smh-split-git-package into master

git package is a bit of a mess. Not only does it define the interfaces and types that the rest of the application should use, various implementations are also defined in the package, most notably the CommandFactory. This makes it difficult for other packages to actually rely on the types in the Git package. While they may want to import a type like git.ObjectID, the implementation in the package may easily lead to cyclic dependencies.

This is the case for example with the storage package where we'd like to define a transaction interface that the rest of the application could import. This is currently not possible as the transaction interface uses git.ObjectID which leads to a cyclic import as the command factory implementation requires storage.Locator. This has lead to defining the Transaction interface in the storagectx package as a workaround.

We'd like to now define the storage layer's interface in the storage package, and this includes the Transaction. This commit splits the Git package to break the cyclic dependency. The goal with the split is to leave domain types and methods associated with them in the git package. This way other packages can import them. The command factory and other functionality that is not purely related to modeling the Git domain types are moved to gitcmd package. This breaks the cyclic dependency and we can now define the Transaction interface in the storage package and import the Git types we need there.

Edited by Sami Hiltunen

Merge request reports

Loading