Skip to content

Commit 17bb758

Browse files
committed
Prevent lfs filters from running on merge
Fixes go-gitea#732
1 parent 31557b1 commit 17bb758

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

models/pull.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,20 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
485485
return fmt.Errorf("git config [core.sparsecheckout -> true]: %v", errbuf.String())
486486
}
487487

488+
// Stop LFS from running its filters
489+
if err := git.NewCommand("config", "--local", "filter.lfs.clean", "").RunInDirPipeline(tmpBasePath, nil, &errbuf); err != nil {
490+
return fmt.Errorf("git config [filter.lfs.clean -> \"\"]: %v", errbuf.String())
491+
}
492+
if err := git.NewCommand("config", "--local", "filter.lfs.smudge", "").RunInDirPipeline(tmpBasePath, nil, &errbuf); err != nil {
493+
return fmt.Errorf("git config [filter.lfs.smudge -> \"\"]: %v", errbuf.String())
494+
}
495+
if err := git.NewCommand("config", "--local", "filter.lfs.process", "").RunInDirPipeline(tmpBasePath, nil, &errbuf); err != nil {
496+
return fmt.Errorf("git config [filter.lfs.process -> \"\"]: %v", errbuf.String())
497+
}
498+
if err := git.NewCommand("config", "--local", "filter.lfs.required", "false").RunInDirPipeline(tmpBasePath, nil, &errbuf); err != nil {
499+
return fmt.Errorf("git config [filter.lfs.required -> false]: %v", errbuf.String())
500+
}
501+
488502
// Read base branch index
489503
if err := git.NewCommand("read-tree", "HEAD").RunInDirPipeline(tmpBasePath, nil, &errbuf); err != nil {
490504
return fmt.Errorf("git read-tree HEAD: %s", errbuf.String())

0 commit comments

Comments
 (0)