[PATCH] fetch2/git: Fix trailing slash in clone command causing double slash in alternates

Jamin Lin <[email protected]>
Newsgroups org.openembedded.lists.bitbake-devel,org.yoctoproject.lists.docs
Message-ID <[email protected]>
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.

Signed-off-by: Jamin Lin <[email protected]>
---
 lib/bb/fetch2/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 01bebb764..b2b39549d 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -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)
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.