diff mbox series

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

Message ID 20260515080327.1285043-2-jamin_lin@aspeedtech.com
State New
Headers show
Series fetch2/git: Fix trailing slash in clone command causing double slash in alternates | expand

Commit Message

Jamin Lin May 15, 2026, 8:03 a.m. UTC
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 <jamin_lin@aspeedtech.com>
---
 lib/bb/fetch2/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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)