Open hansvancalster opened 4 years ago
Fine idea @hansvancalster , you're welcome to add something like that! Don't know whether it's even necessary to add the exception for .gitignore
itself (to be tested, maybe you did).
Personally I find it most convenient when all ignored stuff is in one .gitignore
file at the git repo root and not scattered around, in order to easily manage git. This would mean:
.gitignore
is present and n2khab_data
is still missing in it.n2khab_data
..gitignore
is missing, make it and do the same.n2khab_data
is already in .gitignore
, nothing is to be done.If you like to do deeper checks for existing ignored files, have a look here. Maybe git2r
could help in it. But I wouldn't make it too complicated.
@hansvancalster: the implementation of @ThierryO to use **/n2khab_data
seems better than what I first proposed.
I would like to mention that fileman_folders()
fails if there is no *.Rproj
file in the cwd. However, no Rproj is delivered with the package.
> Error: No root directory found in <path> or its parent directories. Root criterion: contains a file matching "[.]Rproj$" with contents matching "^Version: " in the first line
I would expect the function to have a fallback (instead of adding an rproj, which seems debatable).
This is a bonus. I can just make an Rproj file. But I thought it "low hanging fruit" if we implement checking for a git repo anyways.
Cheers,
Falk
> sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Manjaro Linux
Matrix products: default
BLAS: /usr/lib/libblas.so.3.12.0
LAPACK: /usr/lib/liblapack.so.3.12.0
other attached packages:
[1] units_0.8-5 mapview_2.11.2 sf_1.0-16 lubridate_1.9.3
[5] forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2
[9] readr_2.1.5 tidyr_1.3.1 tibble_3.2.1 ggplot2_3.5.1
[13] tidyverse_2.0.0 knitr_1.48 n2khab_0.10.1
I would like to mention that fileman_folders() fails if there is no *.Rproj file in the cwd.
That's definitely not OK, thanks for reporting. The functions should not be bound by IDE specifics.
Can you make this into a separate issue @falkmielke? I've narrowed the subject of current issue to better reflect the initial idea.
Would be useful for this function to write a .gitignore file when
root = "git"
. to then2khab_data
folder.The contents of the
.gitignore
should be