Web editor: improve edit file and diff preview

This commit is contained in:
Unknwon
2016-08-14 23:02:14 -07:00
parent 660e7a178a
commit cd89f6c502
15 changed files with 477 additions and 475 deletions

View File

@ -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.