From cd89f6c5021ef129ecc4652aa620a3562ae30979 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 14 Aug 2016 23:02:14 -0700 Subject: Web editor: improve edit file and diff preview --- models/wiki.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'models/wiki.go') diff --git a/models/wiki.go b/models/wiki.go index 7a286f4ba3..24cd6aca21 100644 --- a/models/wiki.go +++ b/models/wiki.go @@ -76,24 +76,11 @@ func (repo *Repository) LocalWikiPath() string { // UpdateLocalWiki makes sure the local copy of repository wiki is up-to-date. func (repo *Repository) UpdateLocalWiki() error { - return updateLocalCopy(repo.WikiPath(), repo.LocalWikiPath(), "") + return UpdateLocalCopyBranch(repo.WikiPath(), repo.LocalWikiPath(), "master") } -// discardLocalWikiChanges discards local commits make sure -// it is even to remote branch when local copy exists. func discardLocalWikiChanges(localPath string) error { - if !com.IsExist(localPath) { - return nil - } - // No need to check if nothing in the repository. - if !git.IsBranchExist(localPath, "master") { - return nil - } - - if err := git.ResetHEAD(localPath, true, "origin/master"); err != nil { - return fmt.Errorf("ResetHEAD: %v", err) - } - return nil + return discardLocalRepoBranchChanges(localPath, "master") } // updateWikiPage adds new page to repository wiki. -- cgit v1.2.3