fetch2/git: Tweak git fetcher to handling repo updates correctly
Currently the git fetcher can malfunction when branches change in remote repositories since whilst the update code updates the "origin" remote, this isn't linked to the local heads. By passing the --mirror option to 'git clone' and 'git remote add', linkage between the local heads and remote heads is created with a 1:1 mapping, hence all the appropriate heads are then updated correctly. This fixes some issues which have been seen with the Yocto autobuilder mirrors. (Bitbake rev: 3725602ec53df116dc108b3197a426b86ca43d5f) Signed-off-by: Richard Purdie <richard.purdie@linux-foundation.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
20e8208839
commit
acc75635b8
|
@ -170,7 +170,7 @@ class Git(FetchMethod):
|
|||
|
||||
# If the repo still doesn't exist, fallback to cloning it
|
||||
if not os.path.exists(ud.clonedir):
|
||||
clone_cmd = "%s clone --bare %s://%s%s%s %s" % \
|
||||
clone_cmd = "%s clone --bare --mirror %s://%s%s%s %s" % \
|
||||
(ud.basecmd, ud.proto, username, ud.host, ud.path, ud.clonedir)
|
||||
bb.fetch2.check_network_access(d, clone_cmd)
|
||||
runfetchcmd(clone_cmd, d)
|
||||
|
@ -188,7 +188,7 @@ class Git(FetchMethod):
|
|||
except bb.fetch2.FetchError:
|
||||
logger.debug(1, "No Origin")
|
||||
|
||||
runfetchcmd("%s remote add origin %s://%s%s%s" % (ud.basecmd, ud.proto, username, ud.host, ud.path), d)
|
||||
runfetchcmd("%s remote add --mirror origin %s://%s%s%s" % (ud.basecmd, ud.proto, username, ud.host, ud.path), d)
|
||||
fetch_cmd = "%s fetch --all -t" % ud.basecmd
|
||||
bb.fetch2.check_network_access(d, fetch_cmd, ud.url)
|
||||
runfetchcmd(fetch_cmd, d)
|
||||
|
|
Loading…
Reference in New Issue