[x]
):2017/01/23 12:12:17 [...routers/repo/pull.go:420 MergePullRequest()] [E] Merge: git clone: Cloning into 'data/tmp/repos/216094242.git'...
done.
Downloading nofilter.mp4 (2.06 MB)
Error downloading object: nofilter.mp4 (8a870a2f4efbc72e3686c2936b24c5c6f7ebd9475e2b076bd583086e71a345cf)
I wanted to test the master version of Gitea in order to check the new features including LFS.
I added a new repo in Gitea, pushed a mp4 file which I did set for LFS. The file was properly pushed and stored using LFS.
Then I branched the "master" branch into a "dev". I push a "test.html" file into the "dev" branch. Then in Gitea I created a pull request. Gitea said there were no conflict and that the branch can be merged automatically. But when merging, I got a 500 error (see log above). It seems related to the LFS.
Dunno if I did something wrong, but seems to be a bug to me.
Thanks
@fabian-z could you give some idea?
The error is caused by running Gitea under an OS user with the LFS client hooks installed - a workaround is to create a new user account and run Gitea using that account.
This was - apparently incompletely - fixed in my PR by disabling the hooks for external git operations using global command arguments in code.gitea.io/git
.
Issue here is that the pull request model uses code.gitea.io/gitea/modules/process
package to construct a git command-line: https://github.com/go-gitea/gitea/blob/master/models/pull.go#L284
Therefore, the arguments set for code.gitea.io/git
don't get applied and the operation errors out.
Unfortunately, said package is used in many files to construct custom git command-lines. I originally assumed the git
package would already provide an abstraction layer.
models/git_diff.go
models/release.go
models/repo.go
models/repo_editor.go
models/repo_mirror.go
models/pull.go
We could either instrument these code parts with the necessary arguments, or port the relevant bits for usage with code.gitea.io/git
and get global argument support with it.
Since no PR to be sent, I will move this to v1.2
@fabian-z This is still happening with LFS enabled.
I'm unsure how to run gitea as a local user account.
I tried creating a new user account, and set the service to run under this account, and changing RUN_USER in the app.ini to run under that user, but the service will not start under that configuration.
Got same error and here is gitea.log record:
==> gitea.log <==
2019/03/16 12:31:24 [...routers/repo/pull.go:589 MergePullRequest()] [E] Merge: git merge --no-ff --no-commit [/var/lib/gitea/data/tmp/local-repo/merge-251661747.git]: exec(11:PullRequest.Merge (git merge --no-ff --no-commit): /var/lib/gitea/data/tmp/local-repo/merge-251661747.git) failed: exit status 128(<nil>) stdout: stderr: Downloading Assets/_myproject/Models/humanoid.fbm/tex_diffuse.png (7.1 MB)
hint: The remote resolves to a file:// URL, which can only work with a
hint: standalone transfer agent. See section "Using a Custom Transfer Type
hint: without the API server" in custom-transfers.md for details.
Error downloading object: Assets/_myproject/Models/humanoid.fbm/tex_diffuse.png (142123c): Smudge error: Error downloading Assets/_myproject/Models/humanoid.fbm/tex_diffuse.png (142123cd5c85098a8f3c2ae5e7ac600509cc07bd9cc1d0b2591ea357512eb45e): batch request: missing protocol: "file:///home/git/gitea-repositories/team/myproject.git/info/lfs"
Errors logged to /var/lib/gitea/data/tmp/local-repo/merge-251661747.git/.git/lfs/logs/20190316T123115.744431669.log
Use 'git lfs logs last' to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: Assets/_myproject/Models/humanoid.fbm/tex_diffuse.png: smudge filter lfs failed
- Downloading Assets/_myproject/Models/humanoid.fbm/tex_diffuse.png (7.1 MB)
hint: The remote resolves to a file:// URL, which can only work with a
hint: standalone transfer agent. See section "Using a Custom Transfer Type
hint: without the API server" in custom-transfers.md for details.
Error downloading object: Assets/_myproject/Models/humanoid.fbm/tex_diffuse.png (142123c): Smudge error: Error downloading Assets/_myproject/Models/humanoid.fbm/tex_diffuse.png (142123cd5c85098a8f3c2ae5e7ac600509cc07bd9cc1d0b2591ea357512eb45e): batch request: missing protocol: "file:///home/git/gitea-repositories/team/myproject.git/info/lfs"
Errors logged to /var/lib/gitea/data/tmp/local-repo/merge-251661747.git/.git/lfs/logs/20190316T123115.744431669.log
Use 'git lfs logs last' to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: Assets/_myproject/Models/humanoid.fbm/tex_diffuse.png: smudge filter lfs failed
Application Version: 1.7.0
Installed by folloring this: https://docs.gitea.io/en-us/install-from-binary/
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Ah! I think I understand what's causing this!
Can anyone still reproduce this on 1.8+?
I think I may finally have found the cause.
I suspect that you have git-lfs version greater than 2.3.4 installed on your server and gitea user has a .gitconfig file containing:
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
If you remove that that should act as a workaround.
@Begounet are you able to come up with a minimal example for me? I would love to exactly figure out what is the problem here. I know it's due to the lfs smudge filter but I'd like to catch it in the act.
I think #7062 and this workaround won't be the complete solution because we do need to be aware of lfs additions on merging - i.e. What happens if you add an LFS file through a merge and then delete the adding repository - I'm highly suspicious that this file will be deleted from the LFS.
I will try to setup a server from my home, using the same LFS and Gitea versions but it will take some times since I am not really used to that kind of stuff. Unfortunately, I cannot provide access to our enterprise private servers.
But I think the most important thing is to at least have once LFS filtered file in the commit you want to merge.
And your workaround indeed worked! Thank you!
What happens if you add an LFS file through a merge and then delete the adding repository - I'm highly suspicious that this file will be deleted from the LFS.
Shouldn't be the expected behavior?
@Begounet Was there anything special about your filter configuration in .gitconfig? Was it exactly the same as I put in https://github.com/go-gitea/gitea/issues/732#issuecomment-495972325 ?
The other question is what version of git do you have?
It appears that my PR #7062 is unlikely to be required as we should be setting these (except for process) anyway:
So perhaps you have the lfs process running...
I'll adjust #7062 to ignore the process at this point instead.
In terms of the potential deletion bug: Suppose you have repository A and fork B.
You would need to check the LFS directly to see if it has disappeared.
This problem wouldn't just affect users like you who are likely affected by the lfs filter process but every user of LFS.
I think gitea needs to handle lfs filtering itself.
<repository url>/info/refs?service=git-upload-pack
).And then he founds theses lines in the global config (/etc/gitconfig).
FINALLY! I've managed to reproduce this, and it's stupidly easy to do.
Oh dear.
I'm so sorry this has not been fixed - I can't believe that this has been here for so long.
OK, to reproduce:
git lfs track '*.jpg'
git add .gitattributes
git push
*.jpg filter=lfs diff=lfs merge=lfs -text
on the web interfaceThen with another user, fork the repository
OK I finally have a working and complete bug fix for this in #7082
Now, the problem is that people who have been merging "successfully", i.e. not experiencing #732 won't realise that if they delete their forks their LFS objects will disappear.
Hi, unfortunately we're experiencing this old "500" error when merging pull requests with files in lfs through Gitea.
Also it comes with error log same as reported in #4463. We've checked for the .gitconfig entries mentioned above and there are none.
@kleszcz the mentioned fix for this not present in the 1.8.3 release that you are using. You would need to use master branch or wait for the 1.9 release (1.9 release candidate will be available very soon and hopefully final 1.9 release not terribly long after).
Most helpful comment
OK I finally have a working and complete bug fix for this in #7082
Now, the problem is that people who have been merging "successfully", i.e. not experiencing #732 won't realise that if they delete their forks their LFS objects will disappear.