Skip to content

Fix "west init" failure to detect reinitialization in some cases#936

Open
marc-hb wants to merge 4 commits intozephyrproject-rtos:mainfrom
marc-hb:reinit-fix
Open

Fix "west init" failure to detect reinitialization in some cases#936
marc-hb wants to merge 4 commits intozephyrproject-rtos:mainfrom
marc-hb:reinit-fix

Conversation

@marc-hb
Copy link
Copy Markdown
Collaborator

@marc-hb marc-hb commented Mar 26, 2026

Fixes #935, see commit messages and #935 for details.

cc: @thorsten-klein

marc-hb and others added 2 commits March 26, 2026 18:40
Many tests call create_workspace() which creates a barebones
.west/. Then, they invoked a spurious cmd(['init', '-l',
manifest_repo]) which does not fail because of re-init bug
zephyrproject-rtos#935

To prepare the fix for zephyrproject-rtos#935, drop these spurious calls.

Signed-off-by: Marc Herbert <marc.herbert@gmail.com>
The detection of an already existing workspace was incomplete because it
only checked the current directory. Then, west pretended nothing was
there and silently reset the values in the existing .west/config.

Fix the detection and fail consistently no matter where `west init` is
run from.

Fixes zephyrproject-rtos#935

Signed-off-by: Marc Herbert <Marc.Herbert@gmail.com>
@marc-hb marc-hb marked this pull request as ready for review March 26, 2026 22:52
@marc-hb marc-hb added the bug Something isn't working label Mar 26, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.98%. Comparing base (14c6c4a) to head (6bc2b8f).

Files with missing lines Patch % Lines
src/west/app/project.py 88.88% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #936   +/-   ##
=======================================
  Coverage   85.97%   85.98%           
=======================================
  Files          11       11           
  Lines        3466     3474    +8     
=======================================
+ Hits         2980     2987    +7     
- Misses        486      487    +1     
Files with missing lines Coverage Δ
src/west/app/project.py 80.51% <88.88%> (+0.05%) ⬆️

marc-hb added 2 commits March 28, 2026 10:37
Fix detection of some existing (and very unlikely) .west/ "pollution" at
an intermediate level, for details see first comment at
zephyrproject-rtos#935

This pollution is very unlikely because it's pretty difficult to have
the manifest clone more than one level down before zephyrproject-rtos#774 / zephyrproject-rtos#854 - so it's
difficult to have "intermediate" levels.

Signed-off-by: Marc Herbert <Marc.Herbert@gmail.com>
Add test coverage for the previous commit that fixes the failure to
detect re-initializations described in
zephyrproject-rtos#935

Signed-off-by: Marc Herbert <Marc.Herbert@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"west init topdir/manifest_clone --local" silently resets an existing .west/config

2 participants