Matt Tyers
Matt Tyers

Reputation: 2215

Rbuildignore not ignoring .git

I'm updating a package that is currently on CRAN. Running devtools::check() locally consistently gives the WARNING

> checking package subdirectories ... WARNING
  Found the following directory with the name of a version control directory:
  These should not be in a package tarball.
    ./.git

and NOTE

> checking for hidden files and directories ... NOTE
  Found the following hidden files and directories:
    .git
  These were most likely included in error. See section 'Package
  structure' in the 'Writing R Extensions' manual.
  
  CRAN-pack does not know about
    .git

When I check on winbuilder, I no longer get the WARNING, but I do get the NOTE.

This is my .Rbuildignore file, which should be ignoring the .git folder, but isn't for some reason (?)

^.*\.Rproj$
^\.Rproj\.user$
^cran-comments\.md$
^\.Rhistory$
^docs$
^\.travis\.yml$
^CRAN-RELEASE$
^\.git$
^\.github$

I recently migrated from Windows to Mac (os 12.1), and I'm running R version 4.1.1 and RStudio version 1.4.1717. Thanks for any help - I can't figure this one out, and it's making me crazy.


EDIT: For reproducibility, my package is currently on Github at https://github.com/mbtyers/riverdist

Upvotes: 3

Views: 855

Answers (2)

Matt Tyers
Matt Tyers

Reputation: 2215

This one had a strange and unrelated solution, which I will post in case someone else runs into a similar issue. I should have seen the clue when I ran "build source package" (ordevtools::build() or devtools::check()) and in the long scrolling output would get a long series of

rm: /var/folders/1r/qj42pgb ... 3c4f: Operation not permitted
rm: /var/folders/1r/qj42pgb ... b6ad: Operation not permitted
rm: /var/folders/1r/qj42pgb ... s/e3: Directory not empty
rm: /var/folders/1r/qj42pgb ... c5d0: Operation not permitted

My guess is that when I transferred my work from a Windows machine to a Mac via external drive, some directory was corrupted or there was a permissions issue. If so, I could imagine my machine being unable to follow my .Rbuildignore, or exclude version control directories as mentioned in @user2554330's answer.

Ultimately, I downloaded a fresh version from Github (which I had been pushing to) and built/checked on that, and the issue was gone.

Upvotes: 3

user2554330
user2554330

Reputation: 44867

Edited to simplify:

You can leave .git out of .Rbuildignore completely: version control directories are automatically ignored for several version control systems, including git.

Upvotes: 3

Related Questions