Bug 570758 - LFS: already committed files must be passed through SmudgeFilter
Summary: LFS: already committed files must be passed through SmudgeFilter
Status: RESOLVED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 5.10   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 5.11   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-29 11:20 EST by Thomas Wolf CLA
Modified: 2021-03-02 05:11 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wolf CLA 2021-01-29 11:20:58 EST
See https://www.eclipse.org/forums/index.php/t/1106764/ .

If a repo contains already committed files that later were subject to LFS, they must be passed through.

SmudgeFilter currently always tries to read files as LFS pointers, and always just closes the original InputStream. That won't work.

Example:

git add something.tar
git commit
...
later, maybe much later, the repo is switched to LFS:
echo '*.tar filter=lfs diff=lfs merge=lfs -text' >> .gitattributes
git add .gitattributes
git commit

Now try to clone that repo. SmudgeFilter will parse the tar file, not find a LFS pointer, and close the input stream. The file cannot be checked out, or will be checked out empty.

SmudgeFilter must reset the original input stream if it doesn't contain an LFS pointer. LFSPointer must check more carefully whether something actually looks like a LFS pointer.
Comment 1 Eclipse Genie CLA 2021-01-29 17:05:45 EST
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/175522