Skip to content

Git --depth failed installs #1046

@nparley

Description

@nparley

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions