refactor: adopt github.com/mroth/porcelain/statusv1 for status parsing#100
Merged
refactor: adopt github.com/mroth/porcelain/statusv1 for status parsing#100
Conversation
e957b2f to
612848c
Compare
There was a problem hiding this comment.
Pull Request Overview
This refactoring replaces the existing custom git status parsing logic with an external library github.com/mroth/porcelain/statusv1 to improve separation of concerns and maintainability.
- Adopts external porcelain/statusv1 library for parsing git status output
- Removes internal parsing logic and test code for file path extraction
- Updates test cases to focus on change type extraction rather than full chunk processing
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| go.mod | Adds the new porcelain dependency |
| internal/gitstatus/porcelainv1/process.go | Replaces custom parsing with external library, simplifies processing logic |
| internal/gitstatus/porcelainv1/process_test.go | Updates tests to match new API, removes file path extraction tests |
| internal/commands/status/status.go | Improves error handling with more informative error messages |
Comments suppressed due to low confidence (1)
internal/gitstatus/porcelainv1/process_test.go:126
- This test case appears to test malformed input but doesn't verify that the malformed part is handled correctly. Consider adding assertions to verify the behavior with malformed headers.
// malformed header, missing LF and containing trailing entry
This is the minimum set of changes to slap my experimental git status parsing module in to the existing code. This externalizes git status parsing for separation of concerns Additionally, it is likely we would want to switch to using porcelainv2 in the near future as enabled by github.com/mroth.porcelain, but a phased approach is the plan here.
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.
This is a minimal set of changes to slap my experimental git status parsing module in to the existing code. This externalizes git status parsing for separation of concerns
Additionally, it is highly likely we would want to switch to using
porcelain=v2in the near future as enabled by github.com/mroth/porcelain, but a phased approach is the plan here.