[FIX] forwardport: cached repo setup

Turns out bare repositories (unlike normal ones) don't have any
refspecs by default. So adding the PR refspec would... replace the
default behaviour (apparently?) and the base branches would never get
fetched at all.

--mirror looks to be an other option as it has a default refspec but
it's a bit of an odd duck: it has pull requests in refs/pull but not
all of them? And open / closed doesn't seem to be a factor.
This commit is contained in:
Xavier Morel 2019-09-12 14:36:34 +02:00
parent 60f4db8687
commit 0a64699070

View File

@ -649,6 +649,10 @@ stderr:
], check=True)
# add PR branches as local but namespaced (?)
repo = git(repo_dir)
# bare repos don't have a fetch spec by default (!) so adding one
# removes the default behaviour and stops fetching the base
# branches unless we add an explicit fetch spec for them
repo.config('--add', 'remote.origin.fetch', '+refs/heads/*:refs/heads/*')
repo.config('--add', 'remote.origin.fetch', '+refs/pull/*/head:refs/heads/pull/*')
return repo