1

I have a certain R script which I use in several different repositories. I update it fairly often, and whenever I do I have to remember to update it in every other repository where it's stored, because I need all of them to stay up-to-date. Is there a way to do this automatically, so that whenever one copy of the file is updated all other copies are?

Things I've tried/thought of:

  • Hardlinking: the hard link breaks whenever I do a pull or branch switch that alters the file, because git doesn't keep track of hard link metadata.
    • There used to be a tool called "git metastore" that possibly helped solve this problem but it seems to be offline, and git-cache-meta doesn't store inode values to restore hard links (although if there's a way to modify it such that this can be achieved that would be pretty great).
  • Creating a library: the script contains sensitive information so it cannot be in a publicly hosted library, and privately hosted R libraries can only be updated manually so the problem isn't solved.
  • Reading the file from git: same problem as above, it must be in a private repository which cannot be automatically accessed from R without manual input of credentials.
Pedro Carvalho
  • 565
  • 1
  • 6
  • 26

1 Answers1

0

I would keep it in its own package in its own repo. I don't use Gitlab though, rather Bitbucket for private repo's.

You mentioned it had to be manual but there are some packages in R that aim to secure passwords.

http://blog.revolutionanalytics.com/2015/12/securely-storing-your-secrets-in-r-code.html

Installing non-public packages from Gitlab using devtools::install_git

I would install the package within the repo's that use it, and have some update_package function that will update it when the version changes.

You can add this core R package as a dependency to the R packages that use it too, not tried this before.

https://github.com/r-lib/devtools/blob/master/vignettes/dependencies.Rmd

Is this feasible, as an alternative?

https://docs.gitlab.com/ee/workflow/repository_mirroring.html

Cheers, Jonny

Jonny Phelps
  • 2,687
  • 1
  • 11
  • 20