plugin-git icon indicating copy to clipboard operation
plugin-git copied to clipboard

Submodules don't run LFS checkout

Open yottapanda opened this issue 1 year ago • 0 comments

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

yottapanda avatar Dec 21 '23 16:12 yottapanda