LFS file is not remove when branch is removed. #11515

Closed
opened 2025-11-02 09:39:52 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @ChameleonRed on GitHub (Aug 22, 2023).

Description

I use:

  1. I create branch with files.
  2. I convert files to lfs.
  3. I push this to gitea.
  4. I turn track git lfs track data/**/*.pdf.
  5. I push it to gitea.
  6. I delete branch with git push origin --delete this_branch.

Result branch is deleted but LFS file is not.

  1. Clean up changed nothing (4000 files exists as before).
  2. Clean LFS changed nothing (4000 files exists as before).

After check of files for repository.
Found 4145 blob pointer(s) - 4145 associated, 0 unassociated (0 missing from store)

After long wait for single file check.
No Commits found for this LFS file

File are ophan -> when I check but is it not visible until check each file separetly.

Gitea Version

1.20.3

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

2023/08/22 20:10:55 .../context_response.go:74:HTML() [D] Template: repo/settings/lfs
2023/08/22 20:11:00 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse
2023/08/22 20:11:00 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check
2023/08/22 20:11:00 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch
2023/08/22 20:11:00 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= for-each-ref "--format=%(objectname) %(refname)" refs/heads/ --sort=-committerdate
2023/08/22 20:11:00 .../context_response.go:74:HTML() [D] Template: repo/settings/lfs_file
2023/08/22 20:11:00 ...rvices/lfs/server.go:151:DownloadHandler() [E] Error whilst copying LFS OID[58b0ba3e938e3cf315dee80a22a9a49e261ca81e9a88f278b958842a01d53e0c] to the response after 917504 bytes. Error: http2: stream closed
2023/08/22 20:11:04 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse
2023/08/22 20:11:04 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch
2023/08/22 20:11:04 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check
2023/08/22 20:11:04 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= for-each-ref "--format=%(objectname) %(refname)" refs/heads/ --sort=-committerdate
2023/08/22 20:11:04 .../context_response.go:74:HTML() [D] Template: repo/settings/lfs
2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse
2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch
2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check
2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= for-each-ref "--format=%(objectname) %(refname)" refs/heads/ --sort=-committerdate
2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch
2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check --batch-all-objects
2023/08/22 20:11:06 .../context_response.go:74:HTML() [D] Template: repo/settings/lfs_pointers
2023/08/22 20:11:39 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse
2023/08/22 20:11:39 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch
2023/08/22 20:11:39 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check
2023/08/22 20:11:39 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= for-each-ref "--format=%(objectname) %(refname)" refs/heads/ --sort=-committerdate
2023/08/22 20:11:39 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-list --all
2023/08/22 20:12:28 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= name-rev --stdin --name-only --always
2023/08/22 20:12:28 .../context_response.go:74:HTML() [D] Template: repo/settings/lfs_file_find

Git Version

2.42.0

Operating System

Windows 10

How are you running Gitea?

Windows 10 as service.

Database

SQLite

Originally created by @ChameleonRed on GitHub (Aug 22, 2023). ### Description I use: 1. I create branch with files. 2. I convert files to lfs. 3. I push this to gitea. 4. I turn track `git lfs track data/**/*.pdf`. 5. I push it to gitea. 6. I delete branch with `git push origin --delete this_branch`. Result branch is deleted but LFS file is not. 1. Clean up changed nothing (4000 files exists as before). 2. Clean LFS changed nothing (4000 files exists as before). After check of files for repository. `Found 4145 blob pointer(s) - 4145 associated, 0 unassociated (0 missing from store) ` After long wait for single file check. `No Commits found for this LFS file` File are ophan -> when I check but is it not visible until check each file separetly. ### Gitea Version 1.20.3 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots ``` 2023/08/22 20:10:55 .../context_response.go:74:HTML() [D] Template: repo/settings/lfs 2023/08/22 20:11:00 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse 2023/08/22 20:11:00 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check 2023/08/22 20:11:00 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch 2023/08/22 20:11:00 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= for-each-ref "--format=%(objectname) %(refname)" refs/heads/ --sort=-committerdate 2023/08/22 20:11:00 .../context_response.go:74:HTML() [D] Template: repo/settings/lfs_file 2023/08/22 20:11:00 ...rvices/lfs/server.go:151:DownloadHandler() [E] Error whilst copying LFS OID[58b0ba3e938e3cf315dee80a22a9a49e261ca81e9a88f278b958842a01d53e0c] to the response after 917504 bytes. Error: http2: stream closed 2023/08/22 20:11:04 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse 2023/08/22 20:11:04 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch 2023/08/22 20:11:04 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check 2023/08/22 20:11:04 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= for-each-ref "--format=%(objectname) %(refname)" refs/heads/ --sort=-committerdate 2023/08/22 20:11:04 .../context_response.go:74:HTML() [D] Template: repo/settings/lfs 2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse 2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch 2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check 2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= for-each-ref "--format=%(objectname) %(refname)" refs/heads/ --sort=-committerdate 2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch 2023/08/22 20:11:05 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check --batch-all-objects 2023/08/22 20:11:06 .../context_response.go:74:HTML() [D] Template: repo/settings/lfs_pointers 2023/08/22 20:11:39 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse 2023/08/22 20:11:39 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch 2023/08/22 20:11:39 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check 2023/08/22 20:11:39 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= for-each-ref "--format=%(objectname) %(refname)" refs/heads/ --sort=-committerdate 2023/08/22 20:11:39 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-list --all 2023/08/22 20:12:28 ...dules/git/command.go:281:Run() [D] git.Command.RunDir(C:\Users\Cezary Wagner\gitea-repositories\cezary.wagner\medptr-v2.git): "C:\\Program Files\\Git\\cmd\\git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= name-rev --stdin --name-only --always 2023/08/22 20:12:28 .../context_response.go:74:HTML() [D] Template: repo/settings/lfs_file_find ``` ### Git Version 2.42.0 ### Operating System Windows 10 ### How are you running Gitea? Windows 10 as service. ### Database SQLite
GiteaMirror added the issue/needs-feedback label 2025-11-02 09:39:52 -06:00
Author
Owner

@lunny commented on GitHub (Aug 23, 2023):

There is a background LFS GC task will do that later because of two reasons.
1 the LFS files maybe very big, so deletion needs some time
2 LFS pointers are shared across repositories, so we have a ref count in database.

@lunny commented on GitHub (Aug 23, 2023): There is a background LFS GC task will do that later because of two reasons. 1 the LFS files maybe very big, so deletion needs some time 2 LFS pointers are shared across repositories, so we have a ref count in database.
Author
Owner

@ChameleonRed commented on GitHub (Aug 24, 2023):

There is a background LFS GC task will do that later because of two reasons. 1 the LFS files maybe very big, so deletion needs some time 2 LFS pointers are shared across repositories, so we have a ref count in database.

It is different position and what you wrote do not apply to it.

  1. View shows that file has relation and has not relation - nothing can be both true and false.
  2. Not take time. -> Cron job is off - so it is not need time - I run job manually multiple time - no change I found.
  3. Pointers is not shared. -> Files are specific to one project.

I try to test it on docker image maybe to check if Linux version also has bug.

@ChameleonRed commented on GitHub (Aug 24, 2023): > There is a background LFS GC task will do that later because of two reasons. 1 the LFS files maybe very big, so deletion needs some time 2 LFS pointers are shared across repositories, so we have a ref count in database. It is different position and what you wrote do not apply to it. 1. View shows that file has relation and has not relation - nothing can be both true and false. 2. Not take time. -> Cron job is off - so it is not need time - I run job manually multiple time - no change I found. 3. Pointers is not shared. -> Files are specific to one project. I try to test it on docker image maybe to check if Linux version also has bug.
Author
Owner

@ChameleonRed commented on GitHub (Aug 24, 2023):

Looks same problem is with gitea\gitea docker image - no clean action is done after removal branch with LFS files - not used LFS file is not removed and visible as used before specific file check.

Same behavior I think.

@ChameleonRed commented on GitHub (Aug 24, 2023): Looks same problem is with gitea\gitea docker image - no clean action is done after removal branch with LFS files - not used LFS file is not removed and visible as used before specific file check. Same behavior I think.
Author
Owner

@GiteaBot commented on GitHub (Sep 23, 2023):

We close issues that need feedback from the author if there were no new comments for a month. 🍵

@GiteaBot commented on GitHub (Sep 23, 2023): We close issues that need feedback from the author if there were no new comments for a month. :tea:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11515