Improve destination repository validation and error messages - #3
Merged
quangshuynh merged 1 commit intoAug 27, 2026
Conversation
validate_paths only checked repo.is_dir() and the presence of a .git
entry, so a missing destination, a file passed as the destination, an
inaccessible parent directory, and a broken/incomplete .git entry all
surfaced as one of two generic messages (or an uncaught OSError).
Split destination checks into validate_git_repository(), which now
distinguishes:
- destination does not exist
- destination is not a folder
- destination is not a Git repository
- destination cannot be accessed (permission errors)
- destination Git repository information cannot be determined
(missing HEAD, or a broken/malformed .git worktree pointer file)
Fixes quangshuynh#1
Owner
|
Thanks for the contribution! This covers the destination validation cases well, including malformed and broken worktree pointers, while keeping the validation logic focused and well tested. CI is green, so this looks good to merge. |
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.
Fixes #1
validate_pathsonly checkedrepo.is_dir()and the presence of a.gitentry, so a missing destination, a file passed as the destination, an inaccessible parent directory, and a broken/incomplete.gitentry all surfaced as one of two generic messages (or an uncaughtOSError).Split destination checks into
validate_git_repository(), which now distinguishes the 5 states from the issue's acceptance criteria: destination does not exist, is not a folder, is not a Git repository, cannot be accessed (permission errors), or its Git repository information cannot be determined (missingHEAD, or a broken/malformed.gitworktree pointer file).Added test coverage for each new failure mode plus the existing valid/nested-source cases.