From bfe5b2b91bb21a80d49d329903d96833eff3070a Mon Sep 17 00:00:00 2001 From: rdartus Date: Wed, 4 Nov 2026 06:31:34 +0000 Subject: [PATCH 1/5] Add --git-lfs to enable git-lfs when checking out files With --git-lfs, enable the git-lfs filters in git-sync's private gitconfig (git lfs install --skip-repo), so LFS-tracked files are downloaded when git checks them out (including in submodules) instead of being left as pointers. git-sync fails at startup if git-lfs is not installed, and a sync fails if an LFS object can't be fetched. Note: just running 'git lfs pull' is not enough, since it skips replacing pointer files unless the filters are already configured. --- README.md | 12 ++++++++++++ main.go | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/README.md b/README.md index 62fe13987..c7ce0250c 100644 --- a/README.md +++ b/README.md @@ -391,6 +391,18 @@ OPTIONS useful in cases where data produced by git-sync is used by a different UID. This replaces the older --change-permissions flag. + --git-lfs, $GITSYNC_GIT_LFS + Fetch git-lfs objects for each synced revision, replacing the LFS + pointer files in the worktree with the real file content. This + requires the git-lfs binary to be available (it is included in the + official container image). The LFS endpoint is discovered by + git-lfs in the usual way (e.g. from the repo URL or from a + .lfsconfig file in the repo), and credentials supplied via + --username/--password or --credential are used by git for that + endpoint if it is on the same host as the repo. If not specified, + this defaults to false, in which case LFS-tracked files are left as + pointer files. + -?, -h, --help Print help text and exit. diff --git a/main.go b/main.go index 7b55be5cb..9b8698ff0 100644 --- a/main.go +++ b/main.go @@ -139,6 +139,7 @@ type repoSync struct { ref string // the ref to sync depth int // for shallow sync filter string // for partial clone + gitLFS bool // whether to fetch git-lfs objects submodules submodulesMode // how to handle submodules gc gcMode // garbage collection link absPath // absolute path to the symlink to publish @@ -196,6 +197,9 @@ func main() { flFilter := pflag.String("filter", envString("", "GITSYNC_FILTER"), "use partial clone with the specified filter (e.g. 'blob:none', 'tree:0')") + flGitLFS := pflag.Bool("git-lfs", + envBool(false, "GITSYNC_GIT_LFS"), + "enable git-lfs, so that LFS-tracked files are fetched when checked out (requires git-lfs to be installed)") flSubmodules := pflag.String("submodules", envString("recursive", "GITSYNC_SUBMODULES", "GIT_SYNC_SUBMODULES"), "git submodule behavior: one of 'recursive', 'shallow', or 'off'") @@ -783,6 +787,7 @@ func main() { ref: *flRef, depth: *flDepth, filter: *flFilter, + gitLFS: *flGitLFS, submodules: submodulesMode(*flSubmodules), gc: gcMode(*flGitGC), link: absLink, @@ -823,6 +828,15 @@ func main() { os.Exit(1) } + // If requested, enable the git-lfs filters in our private gitconfig, so + // that LFS-tracked files are downloaded whenever git checks them out. + if *flGitLFS { + if err := git.SetupGitLFS(ctx); err != nil { + log.Error(err, "can't set up git-lfs") + os.Exit(1) + } + } + // If the --repo or any submodule uses SSH, we need to know which keys. if err := git.SetupGitSSH(*flSSHKnownHosts, *flSSHKeyFiles, *flSSHKnownHostsFile); err != nil { log.Error(err, "can't set up git SSH", "keyFiles", *flSSHKeyFiles, "useKnownHosts", *flSSHKnownHosts, "knownHostsFile", *flSSHKnownHostsFile) @@ -2316,6 +2330,25 @@ func (git *repoSync) SetupDefaultGitConfigs(ctx context.Context) error { return nil } +// SetupGitLFS enables the git-lfs clean/smudge filters in the (private) global +// git config. With the filters in place, any `git checkout`/`git reset` that +// writes an LFS-tracked file (including inside submodules) downloads the real +// content instead of leaving a pointer file. This fails if git-lfs is not +// installed, which is what we want: better to refuse to start than to quietly +// publish pointer files. +// +// Note that just running `git lfs pull` is not sufficient, because it will +// download objects but skip replacing the pointer files unless the filters are +// already configured. +func (git *repoSync) SetupGitLFS(ctx context.Context) error { + git.log.V(1).Info("enabling git-lfs") + // --skip-repo: only touch the global config, not hooks in any repo. + if _, _, err := git.Run(ctx, "", "lfs", "install", "--skip-repo"); err != nil { + return fmt.Errorf("error enabling git-lfs: %w", err) + } + return nil +} + // SetupExtraGitConfigs configures the global git environment with user-provided // override settings. func (git *repoSync) SetupExtraGitConfigs(ctx context.Context, configsFlag string, flagName string) error { From 865f8ab8a5c8a4585d1d03eed17e87c67ead2566 Mon Sep 17 00:00:00 2001 From: rdartus Date: Wed, 4 Nov 2026 06:31:34 +0000 Subject: [PATCH 2/5] Add git-lfs to the image, and e2e tests with a minimal LFS server - Dockerfile.in: install git-lfs. - _test_tools/lfs-server: lfs-test-server (public mode) in a scratch image. The binary is built by make test-tools from the version pinned in tools/go.mod, not downloaded at image-build time. - test_e2e.sh: tests for LFS disabled, enabled, --depth, updates and a missing object. No git server is needed: objects are uploaded with git lfs push. --- .gitignore | 1 + Dockerfile.in | 1 + Makefile | 10 +++ _test_tools/lfs-server/Dockerfile | 27 +++++++ _test_tools/lfs-server/README.md | 32 ++++++++ test_e2e.sh | 126 ++++++++++++++++++++++++++++++ tools/tools.go | 1 + 7 files changed, 198 insertions(+) create mode 100644 _test_tools/lfs-server/Dockerfile create mode 100644 _test_tools/lfs-server/README.md diff --git a/.gitignore b/.gitignore index 0b06302fa..16fb49e81 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /.licenses /.push-* /bin +/_test_tools/lfs-server/lfs-test-server diff --git a/Dockerfile.in b/Dockerfile.in index ada3640d6..94f3af40d 100644 --- a/Dockerfile.in +++ b/Dockerfile.in @@ -60,6 +60,7 @@ RUN /stage_binaries.sh -o {ARG_STAGING} \ -p coreutils \ -p curl \ -p git \ + -p git-lfs \ -p gzip \ -p openssh-client \ -p socat \ diff --git a/Makefile b/Makefile index 8b2f73c5e..99884c7c5 100644 --- a/Makefile +++ b/Makefile @@ -276,6 +276,16 @@ test: $(BUILD_DIRS) TEST_TOOLS := $(shell find _test_tools/* -type d -printf "%f ") test-tools: $(foreach tool, $(TEST_TOOLS), .container-test_tool.$(tool)) +# The git-lfs test server is built from the version pinned in tools/go.mod (so +# it is checksum-verified via tools/go.sum), and then copied into an otherwise +# empty image. It is a static binary, so CGO is off and GOOS is always linux. +_test_tools/lfs-server/lfs-test-server: tools/go.mod tools/go.sum + pushd tools >/dev/null; \ + export GOOS=linux GOARCH=$(ARCH) CGO_ENABLED=0; \ + go build -o ../$@ github.com/git-lfs/lfs-test-server; \ + popd >/dev/null +.container-test_tool.lfs-server: _test_tools/lfs-server/lfs-test-server + .container-test_tool.%: _test_tools/% _test_tools/%/* docker build --build-arg ALPINE_REGISTRY_PREFIX="$(ALPINE_REGISTRY_PREFIX)" -t $(REGISTRY)/test/$$(basename $<) $< docker images -q $(REGISTRY)/test/$$(basename $<) > $@ diff --git a/_test_tools/lfs-server/Dockerfile b/_test_tools/lfs-server/Dockerfile new file mode 100644 index 000000000..65f204cce --- /dev/null +++ b/_test_tools/lfs-server/Dockerfile @@ -0,0 +1,27 @@ +# Copyright 2026 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A minimal git-lfs server for tests. The binary is built by `make test-tools` +# from the version pinned in tools/go.mod; this image just wraps it. + +FROM scratch + +COPY lfs-test-server /lfs-test-server + +# No users, no auth: anyone can upload and download. This is a test tool. +ENV LFS_PUBLIC=true +# Storage (a bolt DB and content files) is created in the current directory. +WORKDIR / + +ENTRYPOINT ["/lfs-test-server"] diff --git a/_test_tools/lfs-server/README.md b/_test_tools/lfs-server/README.md new file mode 100644 index 000000000..fb75fedc9 --- /dev/null +++ b/_test_tools/lfs-server/README.md @@ -0,0 +1,32 @@ +# A simple git-lfs server for tests + +DO NOT USE THIS FOR ANYTHING BUT TESTING!!! + +This wraps https://github.com/git-lfs/lfs-test-server in an empty (`scratch`) +image. The server is not downloaded at image-build time: the version is pinned +(and checksummed) in `tools/go.mod` / `tools/go.sum`, and `make test-tools` +compiles it into `lfs-test-server` here before `docker build`. + +It runs in "public" mode, so there are no users or passwords. + +## How to use it + +``` +$ make test-tools +$ docker run --rm --network=host \ + --env LFS_LISTEN=tcp://:9377 --env LFS_HOST=localhost:9377 \ + example.com/test/lfs-server +``` + +`LFS_HOST` is what the server puts in the download/upload URLs it hands to +clients, so it must be an address the client can reach. + +To use it from a git repo, put the URL in `.lfsconfig`, and upload objects +without needing any git server: + +``` +$ git lfs install --local +$ git lfs track '*.bin' +$ printf '[lfs]\n\turl = "http://localhost:9377/"\n' > .lfsconfig +$ git lfs push --all http://localhost:9377/ +``` diff --git a/test_e2e.sh b/test_e2e.sh index a0cf0844b..aeb2bab41 100755 --- a/test_e2e.sh +++ b/test_e2e.sh @@ -376,6 +376,45 @@ function GIT_SYNC() { "$@" } +# git-lfs tests need a git-lfs server. We run a minimal one (see +# _test_tools/lfs-server) on the host network, so it is "localhost" to the host +# (which uploads objects) and to git-sync (which downloads them). +LFS_PORT=9377 + +function lfs_server_start() { + if ! git lfs version >/dev/null 2>&1; then + fail "git-lfs must be installed on the host to run this test" + fi + docker_run \ + --network=host \ + --env LFS_LISTEN="tcp://:$LFS_PORT" \ + --env LFS_HOST="localhost:$LFS_PORT" \ + e2e/test/lfs-server \ + >/dev/null +} + +# Commit a git-lfs tracked file (big.bin) with the given content to $REPO. The +# first call also sets up LFS in the repo. Unless $2 is "no-upload", upload +# the LFS objects to the server (there is no git server involved, only the LFS +# server). Note that the LFS server URL comes from .lfsconfig in the repo. +function lfs_commit() { + local content="$1" + local upload="${2:-upload}" + + if [[ ! -f "$REPO/.lfsconfig" ]]; then + git -C "$REPO" lfs install --local >/dev/null + git -C "$REPO" lfs track '*.bin' >/dev/null + printf '[lfs]\n\turl = "http://localhost:%s/"\n' "$LFS_PORT" > "$REPO/.lfsconfig" + git -C "$REPO" add .gitattributes .lfsconfig + fi + echo "$content" > "$REPO/big.bin" + git -C "$REPO" add big.bin + git -C "$REPO" commit -qm "$content" + if [[ "$upload" == "upload" ]]; then + git -C "$REPO" lfs push --all "http://localhost:$LFS_PORT/" >/dev/null + fi +} + function remove_containers() { sleep 2 # Let docker finish saving container metadata docker ps --filter label="git-sync-e2e=$RUNID" --format="{{.ID}}" \ @@ -3963,6 +4002,93 @@ function e2e::init_max_failures_exceeded() { assert_file_absent "$ROOT/link/file" } +############################################## +# Test git-lfs +############################################## + +# Without --git-lfs, LFS-tracked files are left as pointer files. This also +# shows that the other tests really depend on --git-lfs doing something. +function e2e::git_lfs_disabled() { + lfs_server_start + lfs_commit "${FUNCNAME[0]}" + + GIT_SYNC \ + --one-time \ + --repo="file://$REPO" \ + --root="$ROOT" \ + --link="link" + assert_link_exists "$ROOT/link" + assert_file_contains "$ROOT/link/big.bin" "https://git-lfs.github.com/spec/v1" +} + +function e2e::git_lfs() { + lfs_server_start + lfs_commit "${FUNCNAME[0]}" + + GIT_SYNC \ + --one-time \ + --git-lfs \ + --repo="file://$REPO" \ + --root="$ROOT" \ + --link="link" + assert_link_exists "$ROOT/link" + assert_file_eq "$ROOT/link/big.bin" "${FUNCNAME[0]}" +} + +# LFS objects are fetched on demand for the checked-out commit, so --depth does +# not interfere. +function e2e::git_lfs_depth() { + lfs_server_start + lfs_commit "${FUNCNAME[0]}-1" + lfs_commit "${FUNCNAME[0]}-2" + + GIT_SYNC \ + --one-time \ + --git-lfs \ + --depth=1 \ + --repo="file://$REPO" \ + --root="$ROOT" \ + --link="link" + assert_link_exists "$ROOT/link" + assert_file_eq "$ROOT/link/big.bin" "${FUNCNAME[0]}-2" +} + +function e2e::git_lfs_updates() { + lfs_server_start + lfs_commit "${FUNCNAME[0]}-1" + + GIT_SYNC \ + --period=100ms \ + --git-lfs \ + --repo="file://$REPO" \ + --root="$ROOT" \ + --link="link" \ + & + wait_for_sync "${MAXWAIT}" + assert_link_exists "$ROOT/link" + assert_file_eq "$ROOT/link/big.bin" "${FUNCNAME[0]}-1" + + lfs_commit "${FUNCNAME[0]}-2" + wait_for_sync "${MAXWAIT}" + assert_file_eq "$ROOT/link/big.bin" "${FUNCNAME[0]}-2" +} + +# If an LFS object can't be fetched, the sync must fail rather than publish a +# pointer file. +function e2e::git_lfs_missing_object() { + lfs_server_start + lfs_commit "${FUNCNAME[0]}" "no-upload" + + assert_fail \ + GIT_SYNC \ + --one-time \ + --git-lfs \ + --repo="file://$REPO" \ + --root="$ROOT" \ + --link="link" + assert_file_absent "$ROOT/link/big.bin" +} + # # main # diff --git a/tools/tools.go b/tools/tools.go index 20c7a5c70..d918708c8 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -29,5 +29,6 @@ package tools import ( _ "github.com/estesp/manifest-tool/v2/cmd/manifest-tool" + _ "github.com/git-lfs/lfs-test-server" _ "github.com/google/go-licenses/v2" ) From 72fc23204defa9f548af5e51ab43a8181d777709 Mon Sep 17 00:00:00 2001 From: rdartus Date: Wed, 4 Nov 2026 06:53:26 +0000 Subject: [PATCH 3/5] tools: pin lfs-test-server --- tools/go.mod | 4 ++++ tools/go.sum | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/tools/go.mod b/tools/go.mod index 866d44e7b..fc17822a6 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -4,11 +4,13 @@ go 1.26.10 require ( github.com/estesp/manifest-tool/v2 v2.2.0 + github.com/git-lfs/lfs-test-server v0.4.1-0.20251217053250-d27ad23fddc1 github.com/google/go-licenses/v2 v2.0.0-alpha.1 ) require ( github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect + github.com/boltdb/bolt v1.3.1 // indirect github.com/containerd/containerd v1.6.6 // indirect github.com/containerd/containerd/v2 v2.0.4 // indirect github.com/containerd/errdefs v1.0.0 // indirect @@ -26,6 +28,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/google/licenseclassifier/v2 v2.0.0 // indirect + github.com/gorilla/context v1.1.2 // indirect + github.com/gorilla/mux v1.8.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.17.11 // indirect github.com/kr/pretty v0.3.1 // indirect diff --git a/tools/go.sum b/tools/go.sum index 0405dcbd0..ed709047d 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -9,6 +9,8 @@ github.com/Microsoft/hcsshim v0.12.9 h1:2zJy5KA+l0loz1HzEGqyNnjd3fyZA31ZBCGKacp6 github.com/Microsoft/hcsshim v0.12.9/go.mod h1:fJ0gkFAna6ukt0bLdKB8djt4XIJhF/vEPuoIWYVvZ8Y= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= +github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -62,6 +64,8 @@ github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/git-lfs/lfs-test-server v0.4.1-0.20251217053250-d27ad23fddc1 h1:kHrYPw90YRy3kGYJsMH98dNb1nvcATArSjfKw5NaYDQ= +github.com/git-lfs/lfs-test-server v0.4.1-0.20251217053250-d27ad23fddc1/go.mod h1:vwmiNBvHSN7jmuH6FvFPouJcEZfmce0Uk98CE0xK2lQ= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -106,6 +110,10 @@ github.com/google/licenseclassifier/v2 v2.0.0/go.mod h1:cOjbdH0kyC9R22sdQbYsFkto github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/context v1.1.2 h1:WRkNAv2uoa03QNIc1A6u4O7DAGMUVoopZhkiXWA2V1o= +github.com/gorilla/context v1.1.2/go.mod h1:KDPwT9i/MeWHiLl90fuTgrt4/wPcv75vFAZLaOOcbxM= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= From 50bc6e9fd8f6fcb698498aa3a943b93d1f60ba38 Mon Sep 17 00:00:00 2001 From: rdartus Date: Thu, 5 Nov 2026 07:02:34 +0000 Subject: [PATCH 4/5] e2e: upload the LFS object before committing it git_lfs_updates failed on slower runners: the test committed first and uploaded the LFS object afterwards, so a git-sync polling every 100ms could fetch the new commit before the object existed on the server, and the checkout failed with a 404 (and git-sync exits on the first failure). Stage the file, push its object by ID, and only then commit. --- test_e2e.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test_e2e.sh b/test_e2e.sh index aeb2bab41..e2fa4c9b2 100755 --- a/test_e2e.sh +++ b/test_e2e.sh @@ -395,8 +395,11 @@ function lfs_server_start() { # Commit a git-lfs tracked file (big.bin) with the given content to $REPO. The # first call also sets up LFS in the repo. Unless $2 is "no-upload", upload -# the LFS objects to the server (there is no git server involved, only the LFS +# the LFS object to the server (there is no git server involved, only the LFS # server). Note that the LFS server URL comes from .lfsconfig in the repo. +# +# The object is uploaded BEFORE the commit is created: a running git-sync polls +# $REPO, and as soon as the commit exists it tries to download the object. function lfs_commit() { local content="$1" local upload="${2:-upload}" @@ -409,10 +412,13 @@ function lfs_commit() { fi echo "$content" > "$REPO/big.bin" git -C "$REPO" add big.bin - git -C "$REPO" commit -qm "$content" if [[ "$upload" == "upload" ]]; then - git -C "$REPO" lfs push --all "http://localhost:$LFS_PORT/" >/dev/null + # The staged blob is the LFS pointer, which holds the object's ID. + local oid + oid=$(git -C "$REPO" show :big.bin | sed -n 's/^oid sha256://p') + git -C "$REPO" lfs push --object-id "http://localhost:$LFS_PORT/" "$oid" >/dev/null fi + git -C "$REPO" commit -qm "$content" } function remove_containers() { From 79221b6cf2a7d9781cc29240b74bf4711257bcd7 Mon Sep 17 00:00:00 2001 From: rdartus Date: Fri, 6 Nov 2026 06:39:48 +0000 Subject: [PATCH 5/5] Document --git-lfs in the manual, and fix its README entry The flag was only described in the README, and its text still described a 'git lfs pull' approach. Add it to the manual that --man prints (the manual in main.go and the README carry the same text), place it with the other --git-* flags, and describe the actual behavior. --- README.md | 26 ++++++++++++++------------ main.go | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index c7ce0250c..54a8143f8 100644 --- a/README.md +++ b/README.md @@ -361,6 +361,20 @@ OPTIONS - off: Disable explicit git garbage collection, which may be a good fit when also using --one-time. + --git-lfs, $GITSYNC_GIT_LFS + Enable git-lfs, so that LFS-tracked files are downloaded when git + checks them out (including in submodules) instead of being left as + pointer files. This requires the git-lfs binary to be available + (it is included in the official container image); git-sync exits + at startup if it cannot run git-lfs. The LFS endpoint is + discovered by git-lfs in the usual way (e.g. from the repo URL or + from a .lfsconfig file in the repo). If an LFS object cannot be + fetched, the sync fails and the previously published revision is + kept. Credentials supplied via --username/--password or + --credential are passed to git, so they also apply to an LFS + endpoint on the same host as the repo. If not specified, this + defaults to false. + --github-base-url , $GITSYNC_GITHUB_BASE_URL The GitHub base URL to use in GitHub requests when GitHub app authentication is used. If not specified, defaults to @@ -391,18 +405,6 @@ OPTIONS useful in cases where data produced by git-sync is used by a different UID. This replaces the older --change-permissions flag. - --git-lfs, $GITSYNC_GIT_LFS - Fetch git-lfs objects for each synced revision, replacing the LFS - pointer files in the worktree with the real file content. This - requires the git-lfs binary to be available (it is included in the - official container image). The LFS endpoint is discovered by - git-lfs in the usual way (e.g. from the repo URL or from a - .lfsconfig file in the repo), and credentials supplied via - --username/--password or --credential are used by git for that - endpoint if it is on the same host as the repo. If not specified, - this defaults to false, in which case LFS-tracked files are left as - pointer files. - -?, -h, --help Print help text and exit. diff --git a/main.go b/main.go index 9b8698ff0..9d8fe1808 100644 --- a/main.go +++ b/main.go @@ -2776,6 +2776,20 @@ OPTIONS - off: Disable explicit git garbage collection, which may be a good fit when also using --one-time. + --git-lfs, $GITSYNC_GIT_LFS + Enable git-lfs, so that LFS-tracked files are downloaded when git + checks them out (including in submodules) instead of being left as + pointer files. This requires the git-lfs binary to be available + (it is included in the official container image); git-sync exits + at startup if it cannot run git-lfs. The LFS endpoint is + discovered by git-lfs in the usual way (e.g. from the repo URL or + from a .lfsconfig file in the repo). If an LFS object cannot be + fetched, the sync fails and the previously published revision is + kept. Credentials supplied via --username/--password or + --credential are passed to git, so they also apply to an LFS + endpoint on the same host as the repo. If not specified, this + defaults to false. + --github-base-url , $GITSYNC_GITHUB_BASE_URL The GitHub base URL to use in GitHub requests when GitHub app authentication is used. If not specified, defaults to