Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors caused by force push #1927

Merged
merged 1 commit into from
Jun 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,12 +700,13 @@ func UpdateLocalCopyBranch(repoPath, localPath, branch string) error {
}); err != nil {
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,
Remote: "origin",
Branch: branch,
}); err != nil {
return fmt.Errorf("git pull origin %s: %v", branch, err)

_, err := git.NewCommand("fetch", "origin").RunInDir(localPath)
if err != nil {
return fmt.Errorf("git fetch origin: %v", err)
}
if err := git.ResetHEAD(localPath, true, "origin/"+branch); err != nil {
return fmt.Errorf("git reset --hard origin/%s: %v", branch, err)
}
}
return nil
Expand Down