]> source.dussan.org Git - gitea.git/commitdiff
Fix for #320 345/head
authorBwko <bouwko@gmail.com>
Sat, 3 Dec 2016 21:31:54 +0000 (22:31 +0100)
committerBwko <bouwko@gmail.com>
Sat, 3 Dec 2016 21:31:54 +0000 (22:31 +0100)
Suppress the error when we're removing a file that may not exist

models/pull.go
models/wiki.go

index daed84bf22f2695f735643893264b11d0e408811..5b54058b8df0212c38e3254e6e64882fadabaf69 100644 (file)
@@ -712,9 +712,8 @@ func (pr *PullRequest) PushToBaseRepo() (err error) {
        // Remove head in case there is a conflict.
        file := path.Join(pr.BaseRepo.RepoPath(), headFile)
 
-       if err := os.Remove(file); err != nil {
-               return fmt.Errorf("Fail to remove dir %s: %v", path.Join(pr.BaseRepo.RepoPath(), headFile), err)
-       }
+       _ = os.Remove(file)
+
        if err = git.Push(headRepoPath, tmpRemoteName, fmt.Sprintf("%s:%s", pr.HeadBranch, headFile)); err != nil {
                return fmt.Errorf("Push: %v", err)
        }
index 890e62b0cd9b281afee6636daef35e13e25b52c3..89da4571dbfeca7f682a37c06c50cb0f0bcf295d 100644 (file)
@@ -125,9 +125,7 @@ func (repo *Repository) updateWikiPage(doer *User, oldTitle, title, content, mes
        // So we want to make sure the symlink is removed before write anything.
        // The new file we created will be in normal text format.
 
-       if err := os.Remove(filename); err != nil {
-               return fmt.Errorf("Fail to remove %s: %v", filename, err)
-       }
+       _ = os.Remove(filename)
 
        if err = ioutil.WriteFile(filename, []byte(content), 0666); err != nil {
                return fmt.Errorf("WriteFile: %v", err)