Repository navigation
Fix | Report git errors instead of crashing, clear error outside a project - #359
Merged
Merged
Conversation
…oject - get_root_path runs git with LC_ALL=C, so "not a git repository" is recognized in any locale (#229), and turns any other git error (e.g. dubious ownership) into an ExitError with git's message instead of returning None, which made every command crash with a TypeError - The import-time fallbacks catch that ExitError instead of TypeError (the workaround from #256); the command reports it when it loads the configuration - State.paths raises "Out of Leverage project context" when no project was found, so tofu/terraform/kubectl/tfautomv fail with that message instead of an AttributeError. Commands that work anywhere (--version, --help, run) are unaffected Closes #356 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Coverage Report for CI Build 43722610415Coverage increased (+0.8%) to 78.034%Details
Uncovered Changes
Coverage Regressions71 previously-covered lines in 4 files lost coverage.
Coverage Stats
💛 - Coveralls |
binbashdevops
approved these changes
Nov 15, 2026
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.
What?
TypeErroron every command except--help1with git's message, including itsgit config --global --add safe.directory ...hintget_root_pathreturnedNoneLC_ALL=Ctofu,terraform,kubectl,tfautomvAttributeError: 'NoneType' object has no attribute 'tf_binary'1: "Out of Leverage project context. Please cd into a Leverage project directory first."--version,tofu --help,runHow?
get_root_path(leverage/path.py): forcesLC_ALL=C. Any other git error becomes anExitErrorwith git's stderr; it never returnsNoneanymore. The import-time fallbacks (get_project_root_or_current_dir_path,PROJECT_COMMON_TFVARSincredentials.py) catch that error instead of theTypeErrorworkaround from [229] Fix issue with --version option #256. That workaround was this same bug, reported in Bug |leverage --versionfails when OS locale is not english #229 for git in Spanish.State.paths(leverage/_internals.py): raises the "Out of Leverage project context" error when no project was found, at the moment a command asks for the paths. It's not raised from theleveragecallback because click runs that callback before parsing the subcommand's--help, soleverage tofu --helpoutside a repository would break.credentialsuses the newState.has_pathsfor its bootstrap check.gitfor the dubious ownership and translated-message cases.LC_ALL=Cadded to a test in Enhancement | Test hygiene: coverage floor, real-git root path tests, no duplicate TFRunner tests #357 is gone: the code sets it now.Results
Not related, not touched:
leverage aws configure listends with anawsusage error, on master too. Theconfigurewrapper seems to passlistwithoutconfigure.Closes #356
🤖 Generated with Claude Code