Skip to content

move git backend behind an interface #25752

Open
@6543

Description

@6543

The Issue

The current issue involves the handling of interactions with bare Git repositories.
These interactions are currently integrated throughout the entire codebase.

The challenge revolves around unifying interactions with bare Git repositories while accommodating various backends and storage locations (for addressing storage locations, refer to Issue #25070).

The main objective is to create a central interface that consolidates actions related to Git, allowing for their distribution across different services. The aim is not an immediate replacement of the current implementation, but rather to enable such a transition in the future if necessary.

This proposed solution would also lay the foundation for potentially separating the handling of git-bare-repositories into its own microservice at a later point.

This approach brings several benefits, including the ability for independent development and maintenance of various Git implementations, improved security through Separation of Concerns, and overall enhanced maintainability.

Furthermore, this approach could make Gitea more scalable in conjunction with Issue #25070, enabling the possibility of utilizing different microservices for different repositories, potentially divided by patterns or settings like the starting letters of repositories.

Proposed Solution

The proposed solution involves a phased implementation approach:

Initial Streamlining: The first step is to create a more concise implementation. This includes relocating the specific functions currently present in the modules/git package to a lower package level.

Interface Abstraction & Encapsulation: Following this, a fundamental interface will be established within the modules/git package at a higher package level. This interface will abstract essential functionalities, providing a clear structure for interaction.

Roadmap to Implementation

  1. Module Restructuring: Move the Git module (e.g., module/git) to a submodule within module/git, and initiate the construction of the fundamental interface.

  2. Interface Definition: Define the interface for Git operations (e.g., Git open) incrementally, piece by piece, at module/git.

  3. Backend Segmentation: Segment the implementation of GoGit and NoGoGit, transitioning from using compile flags to run time settings.

  4. Completing the Interface: Finalize the comprehensive interface and align it with the abstraction of Git storage sources (Issue #25070). This enables the assignment of distinct storage areas to various microservices based on repository names, enhancing scalability.

  5. Integration Consideration: Evaluate the integration of libgit2 bindings as another backend behind a compile flag like sqlite support

tldr: This proposal aims to streamline our Git-Interaction in Gitea, leading to improved maintainability, flexibility, security and overall performance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/refactoringExisting code has been cleaned up. There should be no new functionality.type/summaryThis issue aggregates a bunch of other issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions