Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Jamin Lin <jamin_lin@aspeedtech.com>
To: "bitbake-devel@lists.openembedded.org"
	<bitbake-devel@lists.openembedded.org>
Cc: "docs@lists.yoctoproject.org" <docs@lists.yoctoproject.org>,
	Troy Lee <troy_lee@aspeedtech.com>,
	Jamin Lin <jamin_lin@aspeedtech.com>
Subject: [PATCH] fetch2/git: Fix trailing slash in clone command causing double slash in alternates
Date: Fri, 15 May 2026 08:03:29 +0000	[thread overview]
Message-ID: <20260515080327.1285043-2-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20260515080327.1285043-1-jamin_lin@aspeedtech.com>

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 --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


      reply	other threads:[~2026-05-15  8:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15  8:03 [PATCH v1] fetch2/git: Fix trailing slash in clone command causing double slash in alternates Jamin Lin
2026-05-15  8:03 ` Jamin Lin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515080327.1285043-2-jamin_lin@aspeedtech.com \
    --to=jamin_lin@aspeedtech.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=docs@lists.yoctoproject.org \
    --cc=troy_lee@aspeedtech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox