Add .gptinclude functionality and fix XML CDATA handling #17
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.
Overview
This PR adds support for a
.gptinclude
file, allowing users to explicitly specify which files should be included in the repository export. It also fixes an issue with XML output when file content contains CDATA end markers.New Feature:
.gptinclude
SupportThis feature complements the existing
.gptignore
functionality by letting users specify explicitly which files should be included rather than only which to exclude. When both files exist, git2gpt prioritizes.gptinclude
patterns first, then excludes any files that match.gptignore
patterns.Changes:
-I/--include
command-line flag to specify a custom path to.gptinclude
file.gptinclude
in the repository rootBug Fix: XML CDATA Handling
Fixed an issue where the XML export would fail with "unexpected EOF in CDATA section" errors when file content contained the CDATA end marker sequence
]]>
.The fix:
]]>
sequenceTesting Instructions
Testing
.gptinclude
functionality:.gptinclude
file in a test repository with patterns like:git2gpt -o output.txt /path/to/repo
Testing with both
.gptinclude
and.gptignore
:.gptinclude
file withsrc/**
.gptignore
file withsrc/test/**
git2gpt -o output.txt /path/to/repo
src/
except those insrc/test/
are includedTesting XML output fix:
]]>
(common in some code or XML files)git2gpt -x -o output.xml /path/to/repo
Automated Tests
The PR includes a comprehensive test for the
.gptinclude
functionality:Documentation
README.md has been updated with:
.gptinclude
feature.gptinclude
and.gptignore
Potential Impact
These changes are backward compatible and don't affect existing functionality:
.gptignore
will continue to work as before