Skip to content

Introduce new Git repository abstraction

Patrick Steinhardt requested to merge pks-git-repo-abstraction into master

Currently, business logic regarding Git is spilling all over our codebase and not encapsulated at all. While we do have a internal/git package, it doesn't provide much functionality except our Git DSL. The result is duplicated code which is hard to maintain, change and understand.

This merge request introduces a new git.Repository structure. This structure is intended to be the starting point of a new nicer interface around Git logic, encapsulating information required to access a Git repository. Instead of requiring callers to manually assemble Git commands, the vision is that this structure will provide a nice interface abstracting away its implementation details. Instead of calling git update-ref directly, the Repository will provide a function UpdateRef().

Currently, the new structure only contains logic to execute Git commands in the repository and to read and validate references. Eventually, I'd like to extend this interface to contain most of the everyday Git operations we typically do.

Merge request reports