* Prevent server 500 on compare branches with no common history (#6555) * Update code.gitea.io/git module
This commit is contained in:
parent
2551660f49
commit
245089b9c9
6 changed files with 41 additions and 19 deletions
13
vendor/code.gitea.io/git/hook.go
generated
vendored
13
vendor/code.gitea.io/git/hook.go
generated
vendored
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue