Skip to content

Commit

Permalink
Merge pull request #846 from mbjones/master
Browse files Browse the repository at this point in the history
Support packages that are not at the root of a git repository.
  • Loading branch information
hadley committed Jun 19, 2015
2 parents 4d36db5 + b1a3f72 commit f8dd20e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

* Remove explicit `library(testthat)` call in `test()` (#798, @krlmlr)

* Allow release() for packages not located at root of git repository (#845, #846, @mbjones)

# devtools 1.8.0

## Helpers
Expand Down
8 changes: 4 additions & 4 deletions R/git.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ uses_git <- function(path = ".") {
}

git_sha1 <- function(n = 10, path = ".") {
r <- git2r::repository(path)
r <- git2r::repository(path, discover=TRUE)
sha <- git2r::commits(r, n = 1)[[1]]@sha # sha of most recent commit
substr(sha, 1, n)
}

git_uncommitted <- function(path = ".") {
r <- git2r::repository(path)
r <- git2r::repository(path, discover=TRUE)
st <- vapply(git2r::status(r), length, integer(1))
any(st != 0)
}

git_sync_status <- function(path = ".") {
r <- git2r::repository(path)
r <- git2r::repository(path, discover=TRUE)

upstream <- git2r::branch_get_upstream(git2r::head(r))
# fetch(r, branch_remote_name(upstream))
Expand Down Expand Up @@ -67,7 +67,7 @@ github_info <- function(path = ".") {
if (!uses_git(path))
return(github_dummy)

r <- git2r::repository(path)
r <- git2r::repository(path, discover=TRUE)
if (!("origin" %in% git2r::remotes(r)))
return(github_dummy)

Expand Down

0 comments on commit f8dd20e

Please sign in to comment.