diff options
author | Unknwon <u@gogs.io> | 2016-12-23 19:36:16 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-12-23 19:36:16 -0500 |
commit | 42a3bbb0f426720ac4f95a5ca7832f008156cb82 (patch) | |
tree | ca8609c9c2d889b5012f0b01c75842caf216970e /models | |
parent | eb79532812fb2d19e416faee91e64a190b702e7c (diff) |
Fetch before Checkout when create pull request (#3699)
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go index 010c9fad..9cbb1872 100644 --- a/models/repo.go +++ b/models/repo.go @@ -482,6 +482,11 @@ func UpdateLocalCopyBranch(repoPath, localPath, branch string) error { return fmt.Errorf("git clone %s: %v", branch, err) } } else { + if err := git.Fetch(localPath, git.FetchRemoteOptions{ + Prune: true, + }); err != nil { + return fmt.Errorf("git fetch: %v", err) + } if err := git.Checkout(localPath, git.CheckoutOptions{ Branch: branch, }); err != nil { |