summaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-14 23:38:35 -0700
committerUnknwon <u@gogs.io>2016-08-14 23:52:24 -0700
commit54e0ada9d53c28543a436d266dc73e759cc7658b (patch)
treeadafc14fd67620258077d94e96579f47111e87b1 /models/repo.go
parentcd89f6c5021ef129ecc4652aa620a3562ae30979 (diff)
downloadgitea-54e0ada9d53c28543a436d266dc73e759cc7658b.tar.gz
gitea-54e0ada9d53c28543a436d266dc73e759cc7658b.zip
Web editor: improve delete file
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go37
1 files changed, 0 insertions, 37 deletions
diff --git a/models/repo.go b/models/repo.go
index 73950a9fb9..3c2c2650cb 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -2240,43 +2240,6 @@ func (repo *Repository) GetForks() ([]*Repository, error) {
return forks, x.Find(&forks, &Repository{ForkID: repo.ID})
}
-// ________ .__ __ ___________.__.__
-// \______ \ ____ | | _____/ |_ ____ \_ _____/|__| | ____
-// | | \_/ __ \| | _/ __ \ __\/ __ \ | __) | | | _/ __ \
-// | ` \ ___/| |_\ ___/| | \ ___/ | \ | | |_\ ___/
-// /_______ /\___ >____/\___ >__| \___ > \___ / |__|____/\___ >
-// \/ \/ \/ \/ \/ \/
-//
-
-func (repo *Repository) DeleteRepoFile(doer *User, branch, treeName, message string) (err error) {
- repoWorkingPool.CheckIn(com.ToStr(repo.ID))
- defer repoWorkingPool.CheckOut(com.ToStr(repo.ID))
-
- localPath := repo.LocalCopyPath()
- if err = discardLocalRepoBranchChanges(localPath, branch); err != nil {
- return fmt.Errorf("discardLocalRepoChanges: %v", err)
- } else if err = repo.UpdateLocalCopyBranch(branch); err != nil {
- return fmt.Errorf("UpdateLocalCopyBranch: %v", err)
- }
-
- filePath := path.Join(localPath, treeName)
- os.Remove(filePath)
-
- if len(message) == 0 {
- message = "Delete file '" + treeName + "'"
- }
-
- if err = git.AddChanges(localPath, true); err != nil {
- return fmt.Errorf("AddChanges: %v", err)
- } else if err = git.CommitChanges(localPath, message, doer.NewGitSig()); err != nil {
- return fmt.Errorf("CommitChanges: %v", err)
- } else if err = git.Push(localPath, "origin", branch); err != nil {
- return fmt.Errorf("Push: %v", err)
- }
-
- return nil
-}
-
// ____ ___ .__ .___ ___________.___.__
// | | \______ | | _________ __| _/ \_ _____/| | | ____ ______
// | | /\____ \| | / _ \__ \ / __ | | __) | | | _/ __ \ / ___/