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

Git --depth failed installs #1046

Closed
nparley opened this Issue Jan 25, 2016 · 2 comments

Comments

Projects
None yet
1 participant
@nparley
Contributor

nparley commented Jan 25, 2016

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

This comment has been minimized.

Contributor

nparley commented Jan 26, 2016

Created #1048 to fix this problem

nparley added a commit to nparley/devtools that referenced this issue Feb 8, 2016

git_sha1() Fix fetching the latest git commit so that it also works for
shallow git clones, i.e. git clones which make use of depth. (r-lib#1048, r-lib#1046, @nparley)

@hadley hadley closed this in #1048 Apr 11, 2016

@lock

This comment has been minimized.

lock bot commented Sep 18, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Sep 18, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.