Skip to content

feat(AIENG-359): Add GitFileTest to validate text file detection logic#1325

Merged
psakthivel04 merged 2 commits into
v1from
feat/AIENG-359-bin-file
Jun 8, 2026
Merged

feat(AIENG-359): Add GitFileTest to validate text file detection logic#1325
psakthivel04 merged 2 commits into
v1from
feat/AIENG-359-bin-file

Conversation

@psakthivel04

@psakthivel04 psakthivel04 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

This pull request refactors the way the GitFile.isText() method determines whether a file is text or binary, replacing a character-based stream approach with direct UTF-8 decoding. It also adds a new unit test class to ensure correctness, and updates the test suite to include these tests.

Refactoring and bug fixes:

  • Refactored GitFile.isText() to use a UTF-8 decoder with strict error handling (CodingErrorAction.REPORT) on the file's bytes, instead of reading the file as characters. This provides more accurate detection of binary files and improves performance. [1] [2]

Testing improvements:

  • Added a new test class GitFileTest to verify the behavior of GitFile.isText() for text files, binary files, and files with multi-byte UTF-8 content.
  • Updated the AllTests suite to include the new GitFileTest class, ensuring these tests are run automatically.

@psakthivel04 psakthivel04 requested a review from Konboi June 8, 2026 07:16
@psakthivel04 psakthivel04 merged commit 0a35c00 into v1 Jun 8, 2026
15 checks passed
@psakthivel04 psakthivel04 deleted the feat/AIENG-359-bin-file branch June 8, 2026 12:44
This was referenced Jun 8, 2026
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