diff options
author | Unknwon <u@gogs.io> | 2016-08-24 21:35:03 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-24 21:35:03 -0700 |
commit | f8a48ffaad481ee9eaa8a42e0e7d64c12c90ef86 (patch) | |
tree | 21ee3e7965c77c16fcdaa209f01cebae6a809625 /models/repo_editor.go | |
parent | 67fb0fe6a5783f772abfb5438a154435dafff4de (diff) | |
download | gitea-f8a48ffaad481ee9eaa8a42e0e7d64c12c90ef86.tar.gz gitea-f8a48ffaad481ee9eaa8a42e0e7d64c12c90ef86.zip |
Web editor: improve code quality
Diffstat (limited to 'models/repo_editor.go')
-rw-r--r-- | models/repo_editor.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/models/repo_editor.go b/models/repo_editor.go index bbe2ac04bc..e89ad0a401 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 |