Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Paul Barker <paul@pbarker.dev>
To: Jamin Lin <jamin_lin@aspeedtech.com>,
	 "openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>,
	"alex.kanavin@gmail.com" <alex.kanavin@gmail.com>,
	"mathieu.dubois-briand@bootlin.com"
	<mathieu.dubois-briand@bootlin.com>
Cc: Troy Lee <troy_lee@aspeedtech.com>
Subject: Re: [PATCH v4 2/5] devtool: Register nested git repos before the initial commit
Date: Sun, 16 Aug 2026 11:59:11 +0100	[thread overview]
Message-ID: <43b1bcd191c3153ebfa58ad6e85c0eb1764a10b7.camel@pbarker.dev> (raw)
In-Reply-To: <20260731092634.1127862-3-jamin_lin@aspeedtech.com>

On Fri, 2026-07-31 at 09:26 +0000, Jamin Lin wrote:
> setup_git_repo() is meant to convert a git repo that a recipe unpacks
> inside S (e.g. via multiple git SRC_URI entries with different
> destsuffix values) into a regular git submodule, so devtool can later
> tag branches on it and extract patches from it via finish/update.
> 
> That detection never actually triggered, because of the order the
> function ran things in when it had to create the workspace repo itself:
> 
>   1. 'git init'
>   2. 'git add -A .' + initial commit  <- commits the nested repo as a
>                                          bare, unregistered gitlink
>   3. checkout devbranch, tag basetag
>   4. scan 'git status --porcelain' for still-untracked directories
>      ("?? <dir>/") and convert any that are git repos into submodules
> 
> By the time step 4 ran, the nested repo had already been swept up by
> step 2's 'git add -A .': git treats a directory containing its own .git
> as an embedded repo and stages it as a gitlink pointing at its current
> HEAD, without registering it as a submodule. Once that gitlink is
> committed, 'git status --porcelain' reports it as e.g. " M <dir>"
> (already tracked) rather than "?? <dir>/" (untracked), so step 4's
> "line.endswith('/')" check could never match it and the conversion to a
> real submodule silently never happened.
> 
> There is also a second entry path with the same root cause: when the
> recipe's top-level source is itself fetched via git://, repodir is
> already a git repo, so the 'if not .git' block above (init + initial
> commit) is skipped entirely - and so was the detection that lived inside
> it. In that case the nested repo instead gets committed as a bare
> gitlink later, by patch_task_postfunc's 'git add' after do_patch.
> 
> Fix this by extracting the detection into a helper and calling it before
> anything can commit the nested repo as a bare gitlink, in both cases:
>   - freshly-created workspace repo: right after 'git init', before
>     'git add -A .' and the initial commit;
>   - repodir already a git repo: at function entry, before the later
>     'git add' in patch_task_postfunc.
> At those points the nested repo is still untracked and reported with a
> trailing "/", so it is correctly picked up and registered via
> 'git submodule add'.
> 
> Nested repos are discovered top-down (so a repo that manages its own
> submodules via .gitmodules can be skipped rather than descended into),
> but registered bottom-up (deepest first): a parent's commit recording
> its child's HEAD must happen after that child is fully finalized,
> otherwise registering a still-deeper repo afterwards moves the child's
> HEAD forward again and leaves the parent pointing at a stale revision.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>

This commit is doing three things:
- Refactoring existing code into register_nested_git_submodules()
- Modifying the refactored code
- Moving the call site earlier

It's very hard to review this commit and be confident that it is
correct. This should be split into a two or three logical steps with
simpler commit messages.

The wall-of-text commit message and comment suggests to me this may be
generated with AI. Have you read the contributor guide [1]?

[1]: https://docs.yoctoproject.org/contributor-guide/submit-changes.html#acceptance-of-ai-generated-code

Best regards,

-- 
Paul Barker



  reply	other threads:[~2026-08-16 10:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  9:26 [PATCH v4 0/5] devtool: fix standalone clone conversion for nested git repos Jamin Lin
2026-07-31  9:26 ` [PATCH v4 1/5] oe/patch: Skip commitIgnored when nothing is actually staged Jamin Lin
2026-08-16 10:50   ` Paul Barker
2026-08-17  3:57     ` Jamin Lin
2026-07-31  9:26 ` [PATCH v4 2/5] devtool: Register nested git repos before the initial commit Jamin Lin
2026-08-16 10:59   ` Paul Barker [this message]
2026-08-17  3:58     ` Jamin Lin
2026-07-31  9:26 ` [PATCH v4 3/5] devtool-source: Make nested destsuffix git repos standalone Jamin Lin
2026-08-16 11:05   ` Paul Barker
2026-07-31  9:26 ` [PATCH v4 4/5] meta-selftest: Add devtool-test-multi-destsuffix recipe Jamin Lin
2026-07-31  9:26 ` [PATCH v4 5/5] oeqa/selftest/devtool: Add test for multiple nested git destsuffix repos Jamin Lin
2026-08-16 11:08   ` Paul Barker
2026-08-17  4:01     ` Jamin Lin
2026-08-17  6:43 ` [PATCH v4 0/5] devtool: fix standalone clone conversion for nested git repos Jamin Lin

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=43b1bcd191c3153ebfa58ad6e85c0eb1764a10b7.camel@pbarker.dev \
    --to=paul@pbarker.dev \
    --cc=alex.kanavin@gmail.com \
    --cc=jamin_lin@aspeedtech.com \
    --cc=mathieu.dubois-briand@bootlin.com \
    --cc=openembedded-core@lists.openembedded.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