aboutsummaryrefslogtreecommitdiffstats
path: root/models/wiki.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-14 23:02:14 -0700
committerUnknwon <u@gogs.io>2016-08-14 23:52:24 -0700
commitcd89f6c5021ef129ecc4652aa620a3562ae30979 (patch)
treebf476d81479f249d5a1cfb195af2fdee3890d9a1 /models/wiki.go
parent660e7a178a9d72a03d13f704aca61726b4672232 (diff)
downloadgitea-cd89f6c5021ef129ecc4652aa620a3562ae30979.tar.gz
gitea-cd89f6c5021ef129ecc4652aa620a3562ae30979.zip
Web editor: improve edit file and diff preview
Diffstat (limited to 'models/wiki.go')
-rw-r--r--models/wiki.go17
1 files changed, 2 insertions, 15 deletions
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.