Services

Contains the concrete LibGit2Sharp integration and file upload orchestration.

GitCloneService

The GitCloneService implements IGitCloneService and performs the physical repository clone and subsequent data sync.

Deep Business Logic and Flow

  1. Path Resolution & Sanitation: The target URL is parsed to extract a valid filesystem name. The service maps the repository into a structured hierarchy on a local high-performance volume: {baseReposPath}/{tenantId}/{projectId}/{repoName}. This ensures absolute multi-tenant data isolation on disk.

  2. Directory Cleanup: Before cloning, any existing repository at the target path is forcibly deleted. This eliminates git-lock issues and guarantees that the pull is a pristine, complete representation of the external state.

  3. Authentication & Submodules: If a GitToken is present in the request, it is mapped into a LibGit2Sharp UsernamePasswordCredentials provider (using the default oauth2 username). The service executes a robust clone operation that recursively fetches all submodules to ensure the code context is whole.

  4. S3 Synchronization: Once the code is securely on disk, the service triggers IRepoFileStore.UploadRepositoryAsync. The locally cloned code is uploaded into the S3 object store. During this process, user-defined FileExclusions are applied (e.g., ignoring binaries or compiled assets) to avoid polluting the object storage and context windows with unnecessary data.

  5. Error Containment: Git operations are notoriously prone to network and auth exceptions (LibGit2SharpException). The service wraps the operation in strict try-catch blocks to prevent worker crashes, mapping specific failures into a controlled GitCloneResult where Success = false and logging the error message.

0 items under this folder.