Skip to content

Support shallow fetch to optimize start up cost for large repos #127

Open
@tracemeyers

Description

@tracemeyers

I have a lot of OSB provisionings in my git repo and a lot of chatty commits that result in very, very, very long clones every time a new k8s pod of unipipe is created.

It would be great to have an optional env var to configure shallow fetches for such scenarios. Something like this but not hard coded (requires jgit 6.3+).

diff --git a/src/main/kotlin/io/meshcloud/dockerosb/persistence/GitHandlerService.kt b/src/main/kotlin/io/meshcloud/dockerosb/persistence/GitHandlerService.kt
index 4d8d4cd..9b8af45 100644
--- a/src/main/kotlin/io/meshcloud/dockerosb/persistence/GitHandlerService.kt
+++ b/src/main/kotlin/io/meshcloud/dockerosb/persistence/GitHandlerService.kt
@@ -295,6 +295,7 @@ class GitHandlerService(
 
           // fetch remote
           git.fetch()
+              .setDepth(1)
               .apply {
                 refSpecs = listOf(
                     RefSpec("refs/heads/${gitConfig.remoteBranch}:refs/remotes/origin/${gitConfig.remoteBranch}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions