Skip to content
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

Feature/ignore by file extension #4390

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

PhatDave
Copy link

I am surprised (and still in disbelief) that this has not already been implemented
Am I the only one ignoring by wildcard?
My bad if this is actually already a feature, I could not find it

Works exactly like the "ignore" command
But instead of ignoring a file it ignores *. of the selected file

Given a repository with 2 files (changes) - "foo.log" and "bar.log"
Hitting "i" on a "foo.log" would untrack/delete "foo.log" and append "foo.log" to .gitignore
Hitting "I" on a "foo.log" will untrack/delete all .log files - in this case that would be "foo.log" and "bar.log" - and append "*.log" to .gitignore
That's all it does

I did not want to machine translate for any languages so only english.go is updated (ie. we're not very internationalised)
I did not find any tests to ctrl-c ctrl-v (looking for "i"gnore file tests) so none were added
I also could not find any relevant docs to update, I hope to get help with that

  • PR Description

  • Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

@PhatDave
Copy link
Author

Actually there are a few issues that I did not realize at first
First is that already committed/cached files are not deleted/untracked
We'd want to run something like git rm --cached *.<extension>
But I could not figure out how to do this easily

And the other issue is related to the first but applies to files that are staged (so not untracked and not "new" or already in a commit)
The existing ignore command handles them (it) fine but the "ignore extension" one does not untrack *.
But instead only the given file (ie. it behaves just like "i"gnore even though it should do more)
Likewise I could not figure out how we would do this

PhatPhuckDave added 2 commits March 26, 2025 11:05
That works exactly like the "ignore" command
But instead of ignoring a file it ignores *.<extension> of the selected
file
@PhatDave PhatDave force-pushed the feature/ignore-by-file-extension branch from 979450a to c86bb5b Compare March 26, 2025 10:06
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.

1 participant