-
-
Couldn't load subscription status.
- Fork 255
feat: improve repository/directory path resolution #1290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: improve repository/directory path resolution #1290
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1290 +/- ##
==========================================
+ Coverage 43.46% 43.81% +0.35%
==========================================
Files 22 22
Lines 1972 2002 +30
==========================================
+ Hits 857 877 +20
- Misses 1115 1125 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This PR continues the work by cherry-picking commits from the original PR in order to preserve the original author's credit: cc: @KindDragon |
|
Thanks for taking this on @ognis1205 ! Let me know when it's ready for review. |
Thanks, appreciate your help too @orhun ! |
|
You could probably add |
… search functionality Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
This reverts commit 946b5c6. Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
…th changes Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
Signed-off-by: Shingo OKAWA <[email protected]>
554a848 to
08fafd8
Compare
|
Ready for review? |
|
Yup, it's ready to be reviewed. |
Description
This PR includes the previous work related to include_path handling and improves repository path resolution logic.
Closes #1264 .
Changes
Repository::open.Previously, even when the
--repositoryoption was provided, the program still attempted to discover a repository by traversing parent directories from the given path. This behavior was error-prone, so--repositorynow strictly accepts only a repository path (not a child directory).--include_pathdefault behavior (when unspecified).Several reported issues related to cwd handling have been addressed:
The new logic ensures correct behavior when all of the following are true:
cwdis a child of the repository root but not the root itselfargs.repositoryis either None or emptyargs.workdiris Noneinclude_pathis currently emptyPreviously, this was implemented via
pathdiff::diff_paths, which could introduce unintended path components like.or... The new implementation uses absolute path–based resolution to eliminate those inconsistencies.Motivation and Context
Previously, repository and include path resolution had several issues:
--repositorycould ambiguously accept a child path of a repository, leading to error-prone behavior.--include_pathdefault handling (when unspecified) could produce incorrect paths due topathdiff::diff_paths, especially when.or..were involved.This PR resolves these issues by:
Repository::opento strictly enforce valid repository paths.--include_pathhandling to absolute path–based resolution to ensure consistent and predictable behavior.These changes improve reliability and reduce subtle path-related errors in the tool.
How Has This Been Tested?
--git-dirand--work-tree#1255Screenshots / Logs (if applicable)
N/A
Types of Changes
Checklist: