Repository navigation
fix/current directory file parent - #2325
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The test creates initial filesystem state in Python instead of scripted fixtures, conflicting with CONTRIBUTING.md’s fixture requirements.
1 open issue
What changed in this PR
GitHub Copilot reviewed this fix to make assure_directory_exists(..., is_file=True) accept basename-only file paths, addressing the behavior described in #2324.
Changes:
- Use the current directory when a file path has no dirname.
- Add string and
Pathtests covering existing parents, nested-directory creation, and regular-file parent errors.
| File | Description |
|---|---|
test/test_assure_directory.py |
Adds regression tests for file-parent and directory handling. |
git/util.py |
Falls back to os.curdir for file paths without a dirname. |
Review effort: Balanced
`assure_directory_exists("notes.txt", is_file=True)` attempted to create the empty dirname and raised `FileNotFoundError`, despite the current directory already being present.
Interpret an empty parent as `os.curdir` for file inputs. Preserve the helper's return convention, nested parent creation and failures when a parent is an existing regular file.
Use a native scripted filesystem fixture for string and pathlib inputs. Two current-directory cases fail before the fix, while six controls pass. All eight cases pass afterward; utility and typing modules pass on both backends (129 passed, 39 skipped each). Applicable pre-commit checks, including shellcheck, pass.
Assisted-by: OpenAI Codex (model: unknown, autonomous)
Byron
force-pushed
the
fix/current-directory-file-parent
branch
from
October 29, 2026 16:54
5f16c3c to
afbbabf
Compare
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.

supersed #2324