-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Recipe that allows for the removal/negation of gitignore rules. #4610
Conversation
rewrite-core/src/main/java/org/openrewrite/ExcludeFileFromGitignore.java
Show resolved
Hide resolved
rewrite-core/src/main/java/org/openrewrite/ExcludeFileFromGitignore.java
Outdated
Show resolved
Hide resolved
rewrite-core/src/main/java/org/openrewrite/ExcludeFileFromGitignore.java
Outdated
Show resolved
Hide resolved
rewrite-core/src/main/java/org/openrewrite/ExcludeFileFromGitignore.java
Outdated
Show resolved
Hide resolved
rewrite-core/src/main/java/org/openrewrite/ExcludeFileFromGitignore.java
Outdated
Show resolved
Hide resolved
rewrite-core/src/main/java/org/openrewrite/ExcludeFileFromGitignore.java
Outdated
Show resolved
Hide resolved
rewrite-core/src/test/java/org/openrewrite/ExcludeFileFromGitignoreTest.java
Show resolved
Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Thanks @timtebeek, did not get the time for the suggestions yet today. Would've done it otherwise :) About this build failure... Anyhow pushed a change that uses ctx |
@timtebeek, I am done with final polishing. As I identified that the jgit lib is working fine when doing a TreeWalk, I considered probably in there, they do a similar thing bypassing ignoreRule. I think i did a pretty good job (pat on the self-shoulder 😉 ) next to that I also added some logic to insert the new negating lines as close to possible with the ignoring lines. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see you've worked this out; hope this helps you unignore those .jar files ahead of further changes.
What's changed?
Added a recipe
What's your motivation?
First iteration of this seems to work well.
Anyone you would like to review specifically?
@timtebeek as discussed
Have you considered any alternatives or workarounds?
FindAndReplaceText is very restrictive on this. This really uses gitignore rules/logic to determine if a change to the gitignore is necessary.
Any additional context
I've added a workaround for openrewrite/jgit#3
In a next iteration, I want to remove this workaround again once jgit is fixed but guessing we will have some longer checks there.
Planning on 2 later iterations:
Checklist