Install a
pre-commit hook
that reminds you to update your CITATION.cff file. This is a wrapper of
usethis::use_git_hook().
Details
This function installs a pre-commit hook using
usethis::use_git_hook().
A pre-commit hook is a script that identifies simple issues before submission to code review. This pre-commit hook warns you if any of the following conditions are met:
You included your
DESCRIPTIONorinst/CITATIONfile in a commit but did not include yourCITATION.cff, and theCITATION.cfffile is "older" than yourDESCRIPTIONorinst/CITATIONfile.You updated your
CITATION.cffbut did not include it in your commit.
A word of caution
The pre-commit hook may prevent you from committing if you are not updating
your CITATION.cff. However, the detection mechanism is not perfect and may
be triggered even if you have attempted to update your CITATION.cff file.
This typically occurs when you have updated your DESCRIPTION or
inst/CITATION files, but those changes do not affect your
CITATION.cff file (i.e., you are adding new dependencies).
In those cases, you can override the check by running
git commit --no-verify in the terminal.
If you are using RStudio, you can also run this command from an R script by selecting that line and sending it to the terminal using:
Windows & Linux:
Ctrl+Alt+Enter.Mac:
Cmd+Option+Return.
See also
usethis::use_git_hook(), that is the underlying function used bycff_git_hook_install().usethis::use_git()and related function of usethis for using Git with R packages.
Other Git/GitHub helpers provided by cffr:
cff_gha_update()
