Prevent server 500 on compare branches with no common history (#6555) (#6558)

* Prevent server 500 on compare branches with no common history (#6555)
* Update code.gitea.io/git module
This commit is contained in:
zeripath authored and GitHub committed 2019-04-11 21:31:17 +01:00
1 parent 2551660f49
commit 245089b9c9
6 files changed
+41 -19

No files matched your search

+11 -2
View File
@@ -82,11 +82,20 @@ func (h *Hook) Name() string {
func (h *Hook) Update() error {
if len(strings.TrimSpace(h.Content)) == 0 {
if isExist(h.path) {
return os.Remove(h.path)
err := os.Remove(h.path)
if err != nil {
return err
}
}
h.IsActive = false
return nil
}
return ioutil.WriteFile(h.path, []byte(strings.Replace(h.Content, "\r", "", -1)), os.ModePerm)
err := ioutil.WriteFile(h.path, []byte(strings.Replace(h.Content, "\r", "", -1)), os.ModePerm)
if err != nil {
return err
}
h.IsActive = true
return nil
}
// ListHooks returns a list of Git hooks of given repository.