If a repo is cloned with git --depth e.g.
git clone --depth=50 https://github.com/hadley/devtools.git /tmp/devtools/
then
> sha <- git2r::commits(r, n = 1)
> sha
list()
is returning an empty list hence:
> r <- git2r::repository('.', discover = TRUE)
> sha <- git2r::commits(r, n = 1)[[1]]@sha
Error in git2r::commits(r, n = 1)[[1]] : subscript out of bounds
I have added this as an issue for git2r (ropensci/git2r#219) but maybe it is worth catching this and not failing an install on a metadata problem? E.g.:
> install()
...
** R
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (devtools)
Error in git2r::commits(r, n = 1)[[1]] : subscript out of bounds
> traceback()
4: git_sha1(path = x$path)
3: remote_metadata.package(as.package(pkg))
2: remote_metadata(as.package(pkg))
1: install()
If a repo is cloned with git --depth e.g.
then
is returning an empty list hence:
I have added this as an issue for git2r (ropensci/git2r#219) but maybe it is worth catching this and not failing an install on a metadata problem? E.g.: