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

Option to restrict ignore to folders instead of files #5

Open
jpmschuler opened this issue Mar 23, 2020 · 3 comments
Open

Option to restrict ignore to folders instead of files #5

jpmschuler opened this issue Mar 23, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@jpmschuler
Copy link

Wonderful tool!

Due to some package managers using src mode I have a multitude of gitignored folders which have subfolders with a gitignore. This results in a listing like:

- /Users/jpmschuler/Documents/workspace/myproject/.Build/nextlts/vendor/somepackage/ComposerPackagesCommands.php
- /Users/jpmschuler/Documents/workspace/myproject/.Build/staging/vendor/somepackage/ComposerPackagesCommands.php
- /Users/jpmschuler/Documents/workspace/myproject/.Build/nextlts2/vendor/somepackage/Console/ComposerPackagesCommands.php
- /Users/jpmschuler/Documents/workspace/myproject/.Build/production/vendor/somepackage/ComposerPackagesCommands.php
- /Users/jpmschuler/Documents/workspace/myproject/.Build/ddev/vendor/somepackage/ComposerPackagesCommands.php
- /Users/jpmschuler/Documents/workspace/myproject/.Build/dev/vendor/somepackage/ComposerPackagesCommands.php
- /Users/jpmschuler/Documents/workspace/myproject/.Build/

where the last entry would be sufficient

 - /Users/jpmschuler/Documents/workspace/myproject/.Build/

However it came to mind that this only happens with subfiles to an excluded dir, not subfolders. This led to my conclusion, that I don't get why to exclude single files anyways, as it would only be some single files and lead to a load of ignore configuration, which isn't that helpful.

So I'd suggest to have an option (or even default) to only exclude folders.

Proof that this might make sense: a screens long list if I tmignore list | grep .DS_Store

@samuelmeuli
Copy link
Owner

Thanks for opening the issue! I agree, only the .Build folder should be excluded. Would you be able to provide me with a ZIP of such a project so I can debug this locally? :)

I don't quite understand why you'd only want folders to be ignored. Isn't .DS_Store the perfect example for ignoring single files?

@samuelmeuli samuelmeuli added the bug Something isn't working label Mar 24, 2020
@jpmschuler
Copy link
Author

I'll create a MWE in due time (during this week supposedly).

I don't quite understand why you'd only want folders to be ignored. Isn't .DS_Store the perfect example for ignoring single files?

Get your pro arguments, here two con arguments:

  • .DS_Store is local to my machine and thus not saved in the repo because of the .gitignore. If TimeMachine won't back it up, I won't have any means of restoring it, in contrast to e.g. build artifacts or dependencies of a project which I can recreate from some scripts and definitions inside the repo.
  • In other cases I have tool installed via git where the main config file is gitignored, in order not to pollute the tool repo (only a config.sample file is in the repo). This config is even more important than the silly stuff in a .DS_Store, however I won't change the .gitignore, because that's not mine

Of course this might be specific to the projects and technologies one is working with (here especially: npm, composer, docker), but my major usage scenario is drop hundreds of folders like node_modules with 10th of thousands of files, and not some single files with less than 1kb.
I'd rather drop both, but I thought why not ask - don't know that much about Swift, but having one option and and if like isFile won't impact architecture much I believe.

And P.S: this is an enhancement, not really a bug - it doesn't cause any problems at all.

@samuelmeuli
Copy link
Owner

I think these are actually two separate issues:

  • Files in an excluded folder being excluded as well (I condsider this a bug because it's not the behavior I intended)
  • Option to only have tmignore exclude directories (feature suggestion)

You're raising some good points about the second issue. I don't think it's uncommon to ignore single files, though. Consider a .gitignore file with ignore patterns like *.log or *.js (in a TypeScript project where JavaScript is the build output).

I'm wondering if for your use case, it wouldn't be enough to configure tmignore's whitelist to include */.DS_Store and some common config formats (e.g. *.env, *.json, *.yml) to avoid introducing a new option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants