Skip to content

Improve destination repository validation and error messages - #3

Merged
quangshuynh merged 1 commit into
quangshuynh:mainfrom
afonsojanu:fix/destination-git-repository-validation
Aug 27, 2026
Merged

Improve destination repository validation and error messages#3
quangshuynh merged 1 commit into
quangshuynh:mainfrom
afonsojanu:fix/destination-git-repository-validation

Conversation

@afonsojanu

Copy link
Copy Markdown
Contributor

Fixes #1

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 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 (missing HEAD, or a broken/malformed .git worktree pointer file).

Added test coverage for each new failure mode plus the existing valid/nested-source cases.

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
@quangshuynh

Copy link
Copy Markdown
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.

@quangshuynh
quangshuynh merged commit b66ecef into quangshuynh:main Aug 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve validation and error messages for invalid destination repositories

2 participants