hraban / tomono

Multi- To Mono-repository merge
https://tomono.0brg.net
GNU Affero General Public License v3.0
829 stars 136 forks source link

LFS Support? #54

Closed bryceschober closed 1 day ago

bryceschober commented 1 month ago

I wonder what it would take to support LFS, or if that's too big a lift for the plumbing involved...

Here's my public test case:

testmono.repos.txt:

https://github.com/hraban/tomono.git tomono tools/tomono
https://github.com/Apress/repo-with-large-file-storage.git lfsrepo

I have already install git lfs globally, so that I can just git clone from my own repos using LFS and everything "just works":

$ git clone https://github.com/Apress/repo-with-large-file-storage.git
Cloning into 'repo-with-large-file-storage'...
remote: Enumerating objects: 16, done.
remote: Total 16 (delta 0), reused 0 (delta 0), pack-reused 16
Receiving objects: 100% (16/16), 146.84 KiB | 18.36 MiB/s, done.
Resolving deltas: 100% (5/5), done.
$ cd repo-with-large-file-storage
$ git lfs ls-files
6e1b890daf * LargeFile.zip

But when I run tomono, I get:

$ env MONOREPO_NAME=testmono ./tomono/tomono < testmono.repos.txt
...
From https://github.com/Apress/repo-with-large-file-storage
 * [new branch]      master     -> lfsrepo/master
Downloading lfsrepo/LargeFile.zip (208 MB)
Error downloading object: lfsrepo/LargeFile.zip (6e1b890): Smudge error: Error downloading lfsrepo/LargeFile.zip (6e1b890dafa9956b1bdff43b3fd46aaf273085a1d2041bde7efce6cf5eb0262b): batch request: missing protocol: ""

Errors logged to '/home/bschober/git/testmono/.git/lfs/logs/20240607T153027.89679484.log'.
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: lfsrepo/LargeFile.zip: smudge filter lfs failed
hraban commented 1 month ago

Have you tried completely uninstalling LFS, doing the merge, and reinstalling afterwards? I just tried it locally with your example and it seems to work here.

As I understand it LFS is "transparent" to bare git (using smudge filters) and you don't actually have to instantiate anything. In fact it will probably be a lot faster :) then do a git lfs update when you're done.

bryceschober commented 1 month ago

Yep, I think you're right, and for the record for any others setting GIT_LFS_SKIP_SMUDGE=1 is probably the easiest way to disable LFS smudging operations while using this tool.

So, with this testmono.repos.txt:

https://github.com/hraban/tomono.git tomono tools/tomono
https://github.com/Apress/repo-with-large-file-storage.git lfsrepo

...This sequence of commands resulted in the desired behavior:

$ env MONOREPO_NAME=testmono GIT_LFS_SKIP_SMUDGE=1 ./tomono/tomono < testmono.repos.txt
$ git lfs fetch --all lfsrepo