mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-27 07:56:13 +00:00
Fix errors caused by force push (#1927)
This commit is contained in:
parent
96b4780727
commit
e0a63a20e0
@ -700,12 +700,13 @@ func UpdateLocalCopyBranch(repoPath, localPath, branch string) error {
|
|||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("git checkout %s: %v", branch, err)
|
return fmt.Errorf("git checkout %s: %v", branch, err)
|
||||||
}
|
}
|
||||||
if err := git.Pull(localPath, git.PullRemoteOptions{
|
|
||||||
Timeout: time.Duration(setting.Git.Timeout.Pull) * time.Second,
|
_, err := git.NewCommand("fetch", "origin").RunInDir(localPath)
|
||||||
Remote: "origin",
|
if err != nil {
|
||||||
Branch: branch,
|
return fmt.Errorf("git fetch origin: %v", err)
|
||||||
}); err != nil {
|
}
|
||||||
return fmt.Errorf("git pull origin %s: %v", branch, err)
|
if err := git.ResetHEAD(localPath, true, "origin/"+branch); err != nil {
|
||||||
|
return fmt.Errorf("git reset --hard origin/%s: %v", branch, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user