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

interaction with gitignore everything without an extension #2052

Closed
luispfonseca opened this issue Dec 4, 2024 · 3 comments
Closed

interaction with gitignore everything without an extension #2052

luispfonseca opened this issue Dec 4, 2024 · 3 comments

Comments

@luispfonseca
Copy link

luispfonseca commented Dec 4, 2024

I do not know if this is a bug or user error. I have a project using RStan. RStan compiles model code to a binary file without an extension in the name. I don't want this binary file to be committed to git, so I followed a suggestion described here and I have the following block in my .gitignore.

# ignore *everything*
*
!/**/
# and then this 'unignores' anything with an extension
!*.*
# now, the rest of your gitignore should appear after the above
# on windows Stan executables end in .exe
*.exe
# Ignore temporary files created as part of compilation.
*.hpp
*.o

The issue is that renv does not detect any R files in subfolders if I have this in my .gitignore, and thus detects no packages used. This issue does not affect .R files in the root folder of the project; only in subfolders. Is this expected behaviour? I suspect this is not a great use of gitignore, but I'm unsure how to reconcile the two goals here.

Thanks for all the work in the package!

@kevinushey
Copy link
Collaborator

I'm surprised that Stan doesn't give a unique extension to the compiled model files, or something like that... Either way, any divergence between how git and renv interprets the .gitignore file should be considered a bug in renv, so this seems worth fixing.

Regardless, the simplest solution in your case might be to include a .renvignore file, which might include simpler ignore rules. Please see https://rstudio.github.io/renv/reference/dependencies.html#ignoring-files for more details.

kevinushey added a commit that referenced this issue Dec 4, 2024
@kevinushey
Copy link
Collaborator

This should now be fixed up via 9274c79 -- if you're able to test, please let me know if that resolves the problem for you. Thanks for reporting!

@luispfonseca
Copy link
Author

Seems to work now, thanks a lot for the quick fix!

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