From fe501f4d14f73e20218bee2edf2b34b773151e76 Mon Sep 17 00:00:00 2001 From: Andreas Wachter Date: Fri, 11 Sep 2026 13:24:19 +0200 Subject: [PATCH] added lfs to s3 --- conf.example.yml | 1 + gickup_spec.json | 4 ++++ local/local.go | 6 ++++++ main.go | 1 + types/types.go | 1 + 5 files changed, 13 insertions(+) diff --git a/conf.example.yml b/conf.example.yml index e63e773..d1053d5 100644 --- a/conf.example.yml +++ b/conf.example.yml @@ -331,6 +331,7 @@ destination: storageclass: "" # storage class for all repos to be uploaded to this S3 bucket. E.g. for AWS: STANDARD, STANDARD_IA, GLACIER, etc. src_repo_url_tag_key: "" # if set, tag each uploaded object with this key and the source repo URL as value. Leave unset to disable tagging. datecreatedir: false # if true, gickup will create a directory for backup with the creation date + lfs: true # clone lfs repos, !! ATTENTION !! git and git-lfs must be installed on the system! azureblob: - url: https://yourstorageaccount.blob.core.windows.net # blob storage endpoint for your storage account, can be a SAS url container: name of your blob container diff --git a/gickup_spec.json b/gickup_spec.json index ab9600f..d024dbe 100644 --- a/gickup_spec.json +++ b/gickup_spec.json @@ -618,6 +618,10 @@ "datecreatedir": { "type": "boolean", "description": "If true, gickup will create a directory for backup with the creation date" + }, + "lfs": { + "type": "boolean", + "description": "uses lfs to clone repositories" } }, "additionalProperties": false diff --git a/local/local.go b/local/local.go index e4fc5c3..b922056 100644 --- a/local/local.go +++ b/local/local.go @@ -604,6 +604,12 @@ func tempCloneBase(repo types.Repo, tempdir string, isBare bool) (*git.Repositor return r, lfsErr } + // Bare backups already contain all refs and LFS objects. + // Checkout and pull require a working tree and must not run for these clones. + if isBare { + return r, nil + } + // Get the symbolic reference for HEAD headRef, err := r.Head() if err != nil { diff --git a/main.go b/main.go index ba46a42..c5dce47 100644 --- a/main.go +++ b/main.go @@ -256,6 +256,7 @@ func backup(repos []types.Repo, conf *types.Conf) { } defer os.RemoveAll(tempdir) + r.Origin.LFS = d.LFS tempClonePath := path.Join(tempdir, r.Name) _, err = local.TempCloneBare(r, tempClonePath) if err != nil { diff --git a/types/types.go b/types/types.go index 64f7a1e..92838c5 100644 --- a/types/types.go +++ b/types/types.go @@ -595,6 +595,7 @@ type S3Repo struct { StorageClass string `yaml:"storageclass"` DateCreateDir bool `yaml:"datecreatedir"` SrcRepoUrlTagKey *string `yaml:"src_repo_url_tag_key"` + LFS bool `yaml:"lfs"` } func (s3 S3Repo) GetKey(accessString string) (string, error) {