Repository navigation
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.72% +0.26%
==========================================
Files 22 22
Lines 1972 1997 +25
==========================================
+ Hits 857 873 +16
- Misses 1115 1124 +9
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 <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
This reverts commit 946b5c6. Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
…th changes Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
554a848 to
08fafd8
Compare
|
Ready for review? |
|
Yup, it's ready to be reviewed. |
Just as a note, I realized this is pretty breaking for other flags (e.g. workdir) so I reverted it in b4db79f |
Thanks for the note. This PR goes back a bit, so my memory may be imperfect, but I believe this doesn't impact the issue addressed in the PR. |
|
Yup. I think it should be fine. |
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: