Skip to contentSkip to conversation

fetch2: Change git fetcher not to destroy old references

PATCH In review Richard Purdie 2 participants 2 messages Jul 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2: Change git fetcher not to destroy old references

It looks like we're about to see a lot of changes in branch names in repos. If we have the prune option here, those old names are lost, the changes propagate to our source mirrors and our old releases break.

We have the force option so any replaced references should be replaced, its only orphaned branches which will now be preerved.

I believe this behaviour will cause use fewer problems given the changes that look likely to happen.

---
 lib/bb/fetch2/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/git.py +1 -1
index dbf8715674..644ba9238b 100644
@@ -355,7 +355,7 @@ class Git(FetchMethod):
               runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir)
 
             runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, repourl), d, workdir=ud.clonedir)
-            fetch_cmd = "LANG=C %s fetch -f --prune --progress %s refs/*:refs/*" % (ud.basecmd, repourl)
+            fetch_cmd = "LANG=C %s fetch -f --progress %s refs/*:refs/*" % (ud.basecmd, repourl)
             if ud.proto.lower() != 'file':
                 bb.fetch2.check_network_access(d, fetch_cmd, ud.url)
             progresshandler = GitProgressHandler(d)
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Richard Purdie

It looks like we're about to see a lot of changes in branch names in repos. If we have the prune option here, those old names are lost, the changes propagate to our source mirrors and our old releases break.

We have the force option so any replaced references should be replaced, its only orphaned branches which will now be preerved.

Typo: reserved.

Quoted 3 lines

I believe this behaviour will cause use fewer problems given the changes that look likely to happen.

Typo: us

Thanks for this patch!

I too hope this will cause less issues when upstreams tingle with branches in their repos.

What annoys me slightly is that we expect a commit-id to always be in a specific branch and don't fall back to using the commit-id from an older release tag for example if upstream decides to wipe all branches but still keeps the old release tags in repo. Of course sometimes when this happens with our own repos it's nice to see a build failure...

Cheers,

-Mikko

Quoted 20 lines
---
 lib/bb/fetch2/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/git.py +1 -1
index dbf8715674..644ba9238b 100644
@@ -355,7 +355,7 @@ class Git(FetchMethod):
               runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir)
 
             runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, repourl), d, workdir=ud.clonedir)
-            fetch_cmd = "LANG=C %s fetch -f --prune --progress %s refs/*:refs/*" % (ud.basecmd, repourl)
+            fetch_cmd = "LANG=C %s fetch -f --progress %s refs/*:refs/*" % (ud.basecmd, repourl)
             if ud.proto.lower() != 'file':
                 bb.fetch2.check_network_access(d, fetch_cmd, ud.url)
             progresshandler = GitProgressHandler(d)
Signature · 1 line
2.25.1