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

Include git SHA or R package version in metadata for all returned data frames #3

Open
seananderson opened this issue Nov 13, 2020 · 3 comments

Comments

@seananderson
Copy link
Member

Append the R package version or Git SHA into the metadata of the output from the main cache data function... and maybe even all the data frames. (attributes, list element, or data frame column)

@cgrandin
Copy link
Contributor

We can use system() to call git and get the current SHA: https://stackoverflow.com/questions/46376966/how-to-get-sha-of-current-git-commit-from-r

Is the idea to attach this to every saved object, i.e. add a list element called "meta" or something and have is as a sub-list containing the SHA and R package versions or is there a metadata structure in place already?

@seananderson
Copy link
Member Author

I don't think I'd want to rely on system and git because not all users will have Git and not all will have it in their path... oh, more importantly people don't usually use the functions from within the package folder.

My guess is we'd be best off grabbing the installed package version number (and have to be religious about always bumping that). Maintaining an internal object that has the last SHA would be messy since updating it would add a commit.

My guess is attributes is the best place to store this.

@cgrandin
Copy link
Contributor

cgrandin commented Nov 16, 2020

That makes a lot of sense - What about using git hooks to run a script on each commit which updates a file in inst/ext containing the SHA of the commit? Then there's nothing to remember to do each time and I know I will forget.

There is an example of one for pre-commit in .git/hooks/pre-commit.sample

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