aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/vcs/git.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-12-10 10:28:20 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-12-10 10:53:15 +0100
commit9a72bc3440b65a01187ba4277b49d6bd821079cd (patch)
tree51f9d25c08dfa4321a0088a4a3eaa1e4041f7b57 /pkg/vcs/git.go
parentc090b4da255257841173fb4eb18c19d69b293180 (diff)
pkg/vcs: use --force with git fetch
git fetch can fail due to force-recreated tags: > ! [rejected] ext4_for_linus -> ext4_for_linus > (would clobber existing tag) And due to something related to updating local branches (see 'git help fetch' for details). --force should avoid both issues and it seems that we always want force for our purposes (rather than fail update/patch testing).
Diffstat (limited to 'pkg/vcs/git.go')
-rw-r--r--pkg/vcs/git.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/vcs/git.go b/pkg/vcs/git.go
index 2f1f0f301..1a90341ac 100644
--- a/pkg/vcs/git.go
+++ b/pkg/vcs/git.go
@@ -83,7 +83,7 @@ func (git *git) Poll(repo, branch string) (*Commit, error) {
return nil, err
}
}
- if _, err := git.git("fetch"); err != nil {
+ if _, err := git.git("fetch", "--force"); err != nil {
// Something else is wrong, re-clone.
if err := git.clone(repo, branch); err != nil {
return nil, err
@@ -102,7 +102,7 @@ func (git *git) CheckoutBranch(repo, branch string) (*Commit, error) {
repoHash := hash.String([]byte(repo))
// Ignore error as we can double add the same remote and that will fail.
git.git("remote", "add", repoHash, repo)
- _, err := git.git("fetch", repoHash, branch)
+ _, err := git.git("fetch", "--force", repoHash, branch)
if err != nil {
return nil, err
}
@@ -126,7 +126,7 @@ func (git *git) fetchRemote(repo string) error {
repoHash := hash.String([]byte(repo))
// Ignore error as we can double add the same remote and that will fail.
git.git("remote", "add", repoHash, repo)
- _, err := git.git("fetch", "--tags", repoHash)
+ _, err := git.git("fetch", "--force", "--tags", repoHash)
return err
}