From f8a48ffaad481ee9eaa8a42e0e7d64c12c90ef86 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 24 Aug 2016 21:35:03 -0700 Subject: Web editor: improve code quality --- models/repo_editor.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'models/repo_editor.go') diff --git a/models/repo_editor.go b/models/repo_editor.go index bbe2ac04..e89ad0a4 100644 --- a/models/repo_editor.go +++ b/models/repo_editor.go @@ -173,7 +173,7 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) ( } // GetDiffPreview produces and returns diff result of a file which is not yet committed. -func (repo *Repository) GetDiffPreview(branch, treeName, content string) (diff *Diff, err error) { +func (repo *Repository) GetDiffPreview(branch, treePath, content string) (diff *Diff, err error) { repoWorkingPool.CheckIn(com.ToStr(repo.ID)) defer repoWorkingPool.CheckOut(com.ToStr(repo.ID)) @@ -184,13 +184,13 @@ func (repo *Repository) GetDiffPreview(branch, treeName, content string) (diff * } localPath := repo.LocalCopyPath() - filePath := path.Join(localPath, treeName) + filePath := path.Join(localPath, treePath) os.MkdirAll(filepath.Dir(filePath), os.ModePerm) if err = ioutil.WriteFile(filePath, []byte(content), 0666); err != nil { return nil, fmt.Errorf("WriteFile: %v", err) } - cmd := exec.Command("git", "diff", treeName) + cmd := exec.Command("git", "diff", treePath) cmd.Dir = localPath cmd.Stderr = os.Stderr -- cgit v1.2.3