repomix icon indicating copy to clipboard operation
repomix copied to clipboard

Use the contents of .git/info/exclude when useGitignore is set to true.

Open motlin opened this issue 10 months ago • 5 comments

I leave useGitignore set to the default value of true. When running repomix, the repomix-output.txt still contains files that git ignores if they are listed in .git/info/exclude rather than .gitignore.

motlin avatar Feb 26 '25 14:02 motlin

I'm not sure if repomix delegates to git to find ignored files, but the command git ls-files --ignored --others --exclude-standard lists all ignored files, regardless of where the ignore rules lives.

motlin avatar Feb 26 '25 14:02 motlin

Hi, @motlin ! Thank you for reporting this issue! You're absolutely right - we've been missing .git/info/exclude in our implementation.

I'll take the command you mentioned (git ls-files --ignored --others --exclude-standard) as a reference and work to implement a fix that properly handles all Git ignore rules, regardless of where they're defined.

Thanks again for bringing this to our attention! I'll update this issue once the fix is implemented.

yamadashy avatar Feb 27 '25 15:02 yamadashy

Is this something I could help with? I thought the fix might be as simple as https://github.com/motlin/repomix/commit/a719497ef4a90e357b2f89d845fd833d412f70a3 but I tested it manually and it didn't seem to work.

motlin avatar Mar 03 '25 13:03 motlin

Hi @motlin,

Thanks for your investigation!

When we use ignoreFiles with globby, it applies pattern matching based on the relative paths from those ignore files.

For the solution, we likely need to read the .git/info/exclude file in the getIgnorePatterns function and pass the parsed patterns with parseIgnoreContent to the ignore option rather than the ignoreFiles option.

If you'd like to work on this, I'd be happy to assign this issue to you! Let me know if you're interested in implementing the fix.

yamadashy avatar Mar 06 '25 15:03 yamadashy

Hi, @motlin !

This feature has been included in the 0.2.35 release. https://github.com/yamadashy/repomix/releases/tag/v0.2.35

Thank you for your first contribution to the project! I appreciate you taking the time to identify and fix this issue.

Looking forward to any future contributions you might consider!

yamadashy avatar Mar 08 '25 14:03 yamadashy