Repository navigation
Resolve project root in git worktrees for format - #4
Merged
Merged
Conversation
source_dir() used parent(git-dir) as the superproject working tree. That is wrong in a linked git worktree, where git-dir is <primary>/.git/worktrees/<name>, so ninja format looked for .bbp-project.yaml under .git/worktrees and enabled no tools. Use git rev-parse --show-superproject-working-tree (Git 2.13+), falling back to --show-toplevel of the module parent. Never treat parent(git-dir) as a checkout path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bin/format(and thereforeninja format/ninja format-prin NEURON) looked up.bbp-project.yamlviasource_dir(), which usedparent(git-dir)as the superproject working tree.<primary>/.git/worktrees/<name>. The driver then searched.git/worktreesfor the yaml, enabled no tools, and exited 0 — a silent no-op. Same class of checkout:git clone --separate-git-dir.git rev-parse --show-superproject-working-tree(Git 2.13+; empty when not a submodule). Fall back to--show-toplevelof the module parent on older git. Never treatparent(git-dir)as a checkout path.cpp/cmake/cpplib.py. Unit tests cover standalone, primary-clone submodule, linked worktree, and cwd-inside-module.Follow-up: after this merges, NEURON will pin
external/coding-conventionsat the merged master tip (same two-repo order as #3 / nrn #3783). Black version / Python 3.14 is a separate issue and is not in this PR.Test plan
pytest-3 --capture=no(CI) — newdev/test_lib.pycasesPYENV_VERSION=3.12 bin/format -q --lang python <one .py>from an nrngit worktree addcheckout prints the Black version banner and does not printNo tool enabled for task format.bbp-project.yamlcdinto this repo and./bin/format -qstill treats coding-conventions as the project (existing development path)