Skip to content

fix/current directory file parent - #2325

Merged
Byron merged 2 commits into
mainfrom
fix/current-directory-file-parent
Oct 29, 2026
Merged

Byron merged 2 commits into
mainfrom
fix/current-directory-file-parent

Conversation

@Byron

@Byron Byron commented Oct 29, 2026

Copy link
Copy Markdown
Member

supersed #2324

Copilot AI balanced review requested due to automatic review settings October 29, 2026 16:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 Path tests 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

Comment thread test/test_assure_directory.py
gavenren and others added 2 commits October 29, 2026 17:54
`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
Byron force-pushed the fix/current-directory-file-parent branch from 5f16c3c to afbbabf Compare October 29, 2026 16:54
@Byron
Byron merged commit e347d11 into main Oct 29, 2026
67 checks passed
@Byron
Byron deleted the fix/current-directory-file-parent branch October 29, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants