summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-24 21:35:03 -0700
committerUnknwon <u@gogs.io>2016-08-24 21:35:03 -0700
commitf8a48ffaad481ee9eaa8a42e0e7d64c12c90ef86 (patch)
tree21ee3e7965c77c16fcdaa209f01cebae6a809625 /models
parent67fb0fe6a5783f772abfb5438a154435dafff4de (diff)
downloadgitea-f8a48ffaad481ee9eaa8a42e0e7d64c12c90ef86.tar.gz
gitea-f8a48ffaad481ee9eaa8a42e0e7d64c12c90ef86.zip
Web editor: improve code quality
Diffstat (limited to 'models')
-rw-r--r--models/repo.go6
-rw-r--r--models/repo_editor.go6
2 files changed, 6 insertions, 6 deletions
diff --git a/models/repo.go b/models/repo.go
index c8ac584883..728f8c59e4 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -2260,7 +2260,7 @@ func (repo *Repository) GetForks() ([]*Repository, error) {
//
// uploadRepoFiles uploads new files to repository.
-func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, treeName, message string, uuids []string) (err error) {
+func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, treePath, message string, uuids []string) (err error) {
repoWorkingPool.CheckIn(com.ToStr(repo.ID))
defer repoWorkingPool.CheckOut(com.ToStr(repo.ID))
@@ -2276,7 +2276,7 @@ func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, t
repo.CheckoutNewBranch(oldBranchName, branchName)
}
- dirPath := path.Join(localPath, treeName)
+ dirPath := path.Join(localPath, treePath)
os.MkdirAll(dirPath, os.ModePerm)
// Copy uploaded files into repository.
@@ -2298,7 +2298,7 @@ func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, t
}
if len(message) == 0 {
- message = "Add files to '" + treeName + "'"
+ message = "Add files to '" + treePath + "'"
}
if err = git.AddChanges(localPath, true); err != nil {
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