fetch2/git: Fix trailing slash in clone command causing double slash in alternates
PATCH 1/1 fetch2/git: Fix trailing slash in clone command causing double slash in alternates
The unpack() method constructs the git clone command with a trailing slash appended to ud.clonedir:
git clone -s <clonedir>/ <destdir>
When git processes 'clone -s', it writes the source object path into <destdir>/.git/objects/info/alternates by appending '/objects' to the source path. The extra trailing slash produces a double slash:
<clonedir>//objects
Newer versions of git refuse to normalize this path and report:
error: unable to normalize alternate object path: <path>//objects
fatal: bad object HEAD
Remove the spurious trailing slash so the alternates file contains a valid, normalizable path.
--- lib/bb/fetch2/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/git.py +1 -1
@@ -697,7 +697,7 @@ class Git(FetchMethod): if update and os.path.exists(destdir): update_mode = True else: - runfetchcmd("%s clone %s %s/ %s" % (ud.basecmd, ud.cloneflags, ud.clonedir, destdir), d) + runfetchcmd("%s clone %s %s %s" % (ud.basecmd, ud.cloneflags, ud.clonedir, destdir), d) source_found = True else: source_error.append("clone directory not available or not up to date: " + ud.clonedir)
Signature · 1 line
2.43.0
PATCH 1/1 fetch2/git: Fix trailing slash in clone command causing double slash in alternates
The unpack() method constructs the git clone command with a trailing slash appended to ud.clonedir:
git clone -s <clonedir>/ <destdir>
When git processes 'clone -s', it writes the source object path into <destdir>/.git/objects/info/alternates by appending '/objects' to the source path. The extra trailing slash produces a double slash:
<clonedir>//objects
Newer versions of git refuse to normalize this path and report:
error: unable to normalize alternate object path: <path>//objects
fatal: bad object HEAD
Remove the spurious trailing slash so the alternates file contains a valid, normalizable path.
--- lib/bb/fetch2/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/git.py +1 -1
@@ -697,7 +697,7 @@ class Git(FetchMethod): if update and os.path.exists(destdir): update_mode = True else: - runfetchcmd("%s clone %s %s/ %s" % (ud.basecmd, ud.cloneflags, ud.clonedir, destdir), d) + runfetchcmd("%s clone %s %s %s" % (ud.basecmd, ud.cloneflags, ud.clonedir, destdir), d) source_found = True else: source_error.append("clone directory not available or not up to date: " + ud.clonedir)
Signature · 1 line
2.43.0