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

neocities push . incorrectly applying .gitignore rules. #48

Open
MesropM opened this issue Jan 31, 2024 · 1 comment
Open

neocities push . incorrectly applying .gitignore rules. #48

MesropM opened this issue Jan 31, 2024 · 1 comment

Comments

@MesropM
Copy link

MesropM commented Jan 31, 2024

neocities push . will attempt to push files that should be ignored as per the .gitignore file.

I am on a mac and so I have .DS_Store in my .gitignore. Pushing ignores the .DS_Store file in the directory I run it from, but will attempt to push any .DS_Store files it finds in other directories.

For example, I have a folder called fonts, and this has a .DS_Store file in side of it. When attempting to push, neocities will ignore the .DS_Store file in the directory its run from (as expected from the .gitignore), but will attempt to push (and fail to do so) when it finds the .DS_Store file in the fonts directory.

If I try to specify fonts/.DS_Store in my .gitignore file, neocities will successfully ignore the file, but I will have to do this for every directory. It seems that the push command does not check for ignored files in every directory, only the directory it's run from.

It was working as expected, but when I updated to the latest version 0.0.18, this issue began (I do not know which version I updated from).

@vadcx
Copy link

vadcx commented Mar 6, 2024

git check-ignore can be used in a streaming fashion to check any path for ignore rules with only one process invocation:

Command: git check-ignore --no-index --stdin -v
STDIN: here.mysecret <Press Enter or Enter+CTRL-D to end>
STDOUT (after sending the line): .gitignore:1:**.mysecret  here.mysecret

.gitignore:

**.mysecret

This works correctly with any complexity of git's ignore rules and will pick up the repository even if it's in a parent folder. It only DOES NOT ignore the own .git folder by default. Git must have a special handling of its own folder.

The fix should be a relatively simple CLI interaction between neocities and git (#47). The current approach is broken or outright unsafe for possibly leaking secrets. Link to current code I'd have done it if I had any idea of ruby.

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

No branches or pull requests

2 participants