woodpecker-ci / woodpecker-ci/plugin-git

Submodules don't run LFS checkout

Open
#113 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
25
Forks
40
Avg merge
22h 23m
Merged PRs (30d)
6

Description

Say I have repo A and repo B. Repo A includes repo B as a submodule. Repo B has an lfs-stored png.

Using the default clone behaviour, the LFS PNG in repo B is not checked out when running a workflow on repo A.

+ git init -b main
Initialized empty Git repository in /woodpecker/src/git.example.com/keval/a/.git/
+ git config --global --replace-all safe.directory /woodpecker/src/git.example.com/keval/a
+ git remote add origin https://git.example.com/keval/a.git
+ git fetch --no-tags --depth=1 --filter=tree:0 origin +49d20190e4d712d6bd0ed36a771fde165feaee67:
From https://git.example.com/keval/a
 * branch            49d20190e4d712d6bd0ed36a771fde165feaee67 -> FETCH_HEAD
+ git reset --hard -q 49d20190e4d712d6bd0ed36a771fde165feaee67
+ git submodule update --init --recursive --depth=1 --recommend-shallow
Submodule 'assets/b' (https://git.example.com/keval/b.git) registered for path 'assets/b'
Cloning into '/woodpecker/src/git.example.com/keval/a/assets/b'...
Submodule path 'assets/b': checked out '27ca3abfff9c496fe3c8e969f32a057814c14e88'
+ git lfs fetch
fetch: Fetching reference refs/heads/main
+ git lfs checkout

assets/b/lfs.png is still an LFS text file

The following 2 commands fix the problem:

git submodule foreach git lfs pull
git submodule foreach git lfs checkout

But this could probably be tuned

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the repository code that runs git submodule update and git lfs fetch/checkout, then reproduce the nested-submodule case described in the issue. The work is done when an LFS file inside a submodule is checked out as binary content during the normal clone workflow, without the manual foreach commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, go
Domain
ci-cd
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.