Skip to content

Conversation

@jcouball
Copy link
Member

Revert the changes introduced in #64 that allowed the user of this lib to make path normalization optional. The purpose of #64 was to make tests easier to write. The downside was that the library code itself became more complicated.

Instead this change removes that and adds mocking for path normalization when it is appropriate to shut it off for tests.

Revert the changes introduced in #64 that allowed the user of this lib to make
path normalization optional. The purpose of #64 was to make tests easier to
write. The downside was that the library code itself became more complicated.

Instead this change removes that and adds mocking for path normalization
when it is appropriate to shut it off for tests.
@jcouball jcouball requested a review from a team as a code owner March 31, 2025 17:19
@jcouball jcouball requested a review from Copilot March 31, 2025 17:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR reverts the changes from #64 that made path normalization optional by removing the extra parameter and simplifying the code, while introducing mocks in tests to control path normalization for testing purposes.

  • Removed the optional normalization parameter from the Worktree and Repository API.
  • Updated tests to use shared examples for error handling and to mock path normalization.
  • Simplified and refactored initialization logic in production code.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
spec/spec_helper.rb Added shared examples for mocking the normalize_path method for testing.
spec/lib/ruby_git/worktree_spec.rb Removed the optional normalization parameter and outdated contexts.
spec/lib/ruby_git/worktree_add_spec.rb Updated tests to use shared examples for error handling after removing normalize_path.
spec/lib/ruby_git/repository_spec.rb Removed the optional normalization parameter and adjusted test setup accordingly.
lib/ruby_git/worktree.rb Removed the optional normalization parameter and refactored the repository accessor.
lib/ruby_git/repository.rb Removed the optional normalization parameter from initialization and updated its behavior.
Comments suppressed due to low confidence (2)

lib/ruby_git/worktree.rb:218

  • The documentation for the initialize method still references the 'normalize_path' parameter, which has been removed. Please update or remove these comments to reflect the new method signature.
# @param normalize_path [Boolean] if true, path is converted to an absolute path to the root of the working tree

lib/ruby_git/repository.rb:27

  • The initialize method documentation still mentions the 'normalize_path' parameter even though it has been removed. Please update the documentation to match the new signature.
# @param normalize_path [Boolean] if true, path is converted to an absolute path to the root of the working tree

@jcouball jcouball merged commit aa56519 into main Mar 31, 2025
9 checks passed
@jcouball jcouball deleted the remove_normalize_path_flag branch March 31, 2025 17:24
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.

2 participants