mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 10:56:10 +01:00 
			
		
		
		
	Move git diff codes from models to services/gitdiff (#7889)
* move git diff codes from models to services/gitdiff * fix template * fix test * fix template
This commit is contained in:
		
				
					committed by
					
						 techknowlogick
						techknowlogick
					
				
			
			
				
	
			
			
			
						parent
						
							b660a732ae
						
					
				
				
					commit
					c03d75fbd5
				
			| @@ -20,6 +20,7 @@ import ( | ||||
| 	"code.gitea.io/gitea/modules/log" | ||||
| 	"code.gitea.io/gitea/modules/process" | ||||
| 	"code.gitea.io/gitea/modules/setting" | ||||
| 	"code.gitea.io/gitea/services/gitdiff" | ||||
| ) | ||||
|  | ||||
| // TemporaryUploadRepository is a type to wrap our upload repositories as a shallow clone | ||||
| @@ -290,7 +291,7 @@ func (t *TemporaryUploadRepository) Push(doer *models.User, commitHash string, b | ||||
| } | ||||
|  | ||||
| // DiffIndex returns a Diff of the current index to the head | ||||
| func (t *TemporaryUploadRepository) DiffIndex() (diff *models.Diff, err error) { | ||||
| func (t *TemporaryUploadRepository) DiffIndex() (diff *gitdiff.Diff, err error) { | ||||
| 	timeout := 5 * time.Minute | ||||
| 	ctx, cancel := context.WithTimeout(context.Background(), timeout) | ||||
| 	defer cancel() | ||||
| @@ -313,7 +314,7 @@ func (t *TemporaryUploadRepository) DiffIndex() (diff *models.Diff, err error) { | ||||
| 	pid := process.GetManager().Add(fmt.Sprintf("diffIndex [repo_path: %s]", t.repo.RepoPath()), cmd) | ||||
| 	defer process.GetManager().Remove(pid) | ||||
|  | ||||
| 	diff, err = models.ParsePatch(setting.Git.MaxGitDiffLines, setting.Git.MaxGitDiffLineCharacters, setting.Git.MaxGitDiffFiles, stdout) | ||||
| 	diff, err = gitdiff.ParsePatch(setting.Git.MaxGitDiffLines, setting.Git.MaxGitDiffLineCharacters, setting.Git.MaxGitDiffFiles, stdout) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("ParsePatch: %v", err) | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user