Skip to content

Commit

Permalink
Merge pull request #1 from LooDaHu/master
Browse files Browse the repository at this point in the history
Fix to compilation bugs
  • Loading branch information
EngineerDanny authored Jun 7, 2022
2 parents 66eb6f8 + 27497a1 commit 44e4a59
Show file tree
Hide file tree
Showing 4 changed files with 439 additions and 550 deletions.
8 changes: 4 additions & 4 deletions R/branch_metrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ time_branch <- function(test_path, branch = "master", num_commits = 5) {

# Git operations
target <- git2r::repository("./")
origin_state <- git2r::head(target)
origin_state <- git2r::repository_head(target)
git2r::checkout(target, branch)
on.exit(expr = git2r::checkout(origin_state))

Expand Down Expand Up @@ -194,7 +194,7 @@ compare_branchm <- function(test_path, branch1, branch2 = "master") {
stopifnot(length(branch2) == 1)

target <- git2r::repository("./")
original_state <- git2r::head(target)
original_state <- git2r::repository_head(target)
same_commit <- .common_commit(branch1 = branch1, branch2 = branch2)
# same_commit
# ---------------------------------------------
Expand Down Expand Up @@ -239,7 +239,7 @@ compare_branchm <- function(test_path, branch1, branch2 = "master") {
target1 <- git2r::repository(file.path("./"))
# If branch1 is specified, check out to it and obtain commit list
if (!is.null(branch1)) {
original_state1 <- git2r::head(target1)
original_state1 <- git2r::repository_head(target1)
git2r::checkout(object = target1, branch = branch1)
}
commitlist1 <- git2r::commits(target1)
Expand All @@ -256,7 +256,7 @@ compare_branchm <- function(test_path, branch1, branch2 = "master") {
target2 <- git2r::repository(file.path("./"))
# If branch2 is specified, check out to it and obtain commit list
if (!is.null(branch2)) {
original_state2 <- git2r::head(target2)
original_state2 <- git2r::repository_head(target2)
git2r::checkout(object = target2, branch = branch2)
}
commitlist2 <- git2r::commits(target2)
Expand Down
11 changes: 6 additions & 5 deletions R/git_help.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @param commit_val git commit object, as returned by git2r::commits()
#'
#' @seealso \code{\link[git2r]{commits}}

# The get_sha function, given a git commit object returns a character vector which is the
# SHA1 value for the given commit.

Expand All @@ -15,7 +15,7 @@ get_sha <- function(commit_val) {
print(commit_val)
stopifnot(git2r::is_commit(commit_val))

attr(commit_val, which = "sha")
commit_val$sha
}

## -----------------------------------------------------------------------------------------
Expand All @@ -33,7 +33,7 @@ get_datetime <- function(commit_val) {
print(commit_val)
stopifnot(git2r::is_commit(commit_val))

methods::as((commit_val@committer@when), "POSIXct")
as.POSIXct(git2r::when(commit_val$author$when))
}

## -----------------------------------------------------------------------------------------
Expand All @@ -55,7 +55,7 @@ get_msg <- function(commit_val) {
print(commit_val)
stopifnot(git2r::is_commit(commit_val))

base::substr(commit_val@summary, start = 1, stop = 15)
base::substr(commit_val$summary, start = 1, stop = 15)
}

## -----------------------------------------------------------------------------------------
Expand All @@ -71,7 +71,8 @@ get_msg <- function(commit_val) {

get_branch <- function(dir_path = "./") {
repo <- git2r::repository(dir_path)
git2r::head(repo)@name
git2r::repository_head(repo)$name
}

## -----------------------------------------------------------------------------------------

Loading

0 comments on commit 44e4a59

Please sign in to comment.