bitbake: fetch2: git: revert path checks
PATCH 1/1 bitbake: fetch2: git: revert path checks
Commit 10f38157a069cb6938323cadd5e523037a29ace9 triggers re-clones of uptodate repositories when their access path changes. This is wrong. It is enough that needed commits are found from the git repo. For example when same DL_DIR is accessed using two different paths due to a symlink, then the resulting absolute paths will differ but the content is the same. Trust the content.
Avoids extra downloads of large repositories like linux-yocto for kernel when the local cache was already uptodate.
Signed-off-by Mikko Rapeli <[email protected]>
--- bitbake/lib/bb/fetch2/git.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
bitbake/lib/bb/fetch2/git.py +1 -13
@@ -371,19 +371,7 @@ class Git(FetchMethod): # The directory may exist, but not be the top level of a bare git # repository in which case it needs to be deleted and re-cloned. try: - # Since clones can be bare, use --absolute-git-dir instead of --show-toplevel - output = runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir) - - toplevel = os.path.abspath(output.rstrip()) - abs_clonedir = os.path.abspath(ud.clonedir).rstrip('/') - # The top level Git directory must either be the clone directory - # or a child of the clone directory. Any ancestor directory of - # the clone directory is not valid as the Git directory (and - # probably belongs to some other unrelated repository), so a - # clone is required - if os.path.commonprefix([abs_clonedir, toplevel]) != abs_clonedir: - logger.warning("Top level directory '%s' doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir) - needs_clone = True + runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir) except bb.fetch2.FetchError as e: logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e) needs_clone = True
Signature · 1 line
2.34.1