Skip to content

Instantly share code, notes, and snippets.

@nfultz
Created January 19, 2018 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nfultz/f30d8ab3d8ceb6475454647137970c0a to your computer and use it in GitHub Desktop.
Save nfultz/f30d8ab3d8ceb6475454647137970c0a to your computer and use it in GitHub Desktop.
Debugging drat
> debug(add)
> drat::insertPackage("drat_0.1.4.zip", "mydrat", "my commit message")
debugging in: git2r::add(repo, file.path(reldir, pkg))
debug: standardGeneric("add")
Browse[2]> debug(getMethod(git2r::add, signature("git_repository", "character")))
Browse[2]> c
debugging in: git2r::add(repo, file.path(reldir, pkg))
debug: {
.local <- function (repo, path, force = FALSE)
{
repo_wd <- normalizePath(workdir(repo), winslash = "/")
if (!length(grep("/$", repo_wd)))
repo_wd <- paste0(repo_wd, "/")
path <- vapply(path, function(p) {
np <- suppressWarnings(normalizePath(p, winslash = "/"))
if (!file.exists(np)) {
if (length(grep("^[.]/", np))) {
nd <- suppressWarnings(normalizePath(dirname(p),
winslash = "/"))
if (!length(grep("/$", nd)))
nd <- paste0(nd, "/")
np <- paste0(nd, basename(np))
}
}
if (!length(grep(paste0("^", repo_wd), np)))
return(p)
sub(paste0("^", repo_wd), "", np)
}, character(1))
.Call(git2r_index_add_all, repo, path, force)
invisible(NULL)
}
.local(repo, path, ...)
}
Browse[2]> n
debug: .local <- function (repo, path, force = FALSE)
{
repo_wd <- normalizePath(workdir(repo), winslash = "/")
if (!length(grep("/$", repo_wd)))
repo_wd <- paste0(repo_wd, "/")
path <- vapply(path, function(p) {
np <- suppressWarnings(normalizePath(p, winslash = "/"))
if (!file.exists(np)) {
if (length(grep("^[.]/", np))) {
nd <- suppressWarnings(normalizePath(dirname(p),
winslash = "/"))
if (!length(grep("/$", nd)))
nd <- paste0(nd, "/")
np <- paste0(nd, basename(np))
}
}
if (!length(grep(paste0("^", repo_wd), np)))
return(p)
sub(paste0("^", repo_wd), "", np)
}, character(1))
.Call(git2r_index_add_all, repo, path, force)
invisible(NULL)
}
Browse[2]> n
debug: .local(repo, path, ...)
Browse[2]> s
debugging in: .local(repo, path, ...)
debug: {
repo_wd <- normalizePath(workdir(repo), winslash = "/")
if (!length(grep("/$", repo_wd)))
repo_wd <- paste0(repo_wd, "/")
path <- vapply(path, function(p) {
np <- suppressWarnings(normalizePath(p, winslash = "/"))
if (!file.exists(np)) {
if (length(grep("^[.]/", np))) {
nd <- suppressWarnings(normalizePath(dirname(p),
winslash = "/"))
if (!length(grep("/$", nd)))
nd <- paste0(nd, "/")
np <- paste0(nd, basename(np))
}
}
if (!length(grep(paste0("^", repo_wd), np)))
return(p)
sub(paste0("^", repo_wd), "", np)
}, character(1))
.Call(git2r_index_add_all, repo, path, force)
invisible(NULL)
}
Browse[3]> repo
Local: gh-pages C:/Users/nfultz/AppData/Local/Temp/RtmpIVh1mb/mydrat/
Head: [6f15b4a] 2018-01-19: Initial Commit
Browse[3]> path
[1] "bin/windows/contrib/3.4/drat_0.1.4.zip"
Browse[3]> n
debug: repo_wd <- normalizePath(workdir(repo), winslash = "/")
Browse[3]> n
debug: if (!length(grep("/$", repo_wd))) repo_wd <- paste0(repo_wd,
"/")
Browse[3]> repo_wd
[1] "C:/Users/nfultz/AppData/Local/Temp/RtmpIVh1mb/mydrat/"
Browse[3]> n
debug: path <- vapply(path, function(p) {
np <- suppressWarnings(normalizePath(p, winslash = "/"))
if (!file.exists(np)) {
if (length(grep("^[.]/", np))) {
nd <- suppressWarnings(normalizePath(dirname(p),
winslash = "/"))
if (!length(grep("/$", nd)))
nd <- paste0(nd, "/")
np <- paste0(nd, basename(np))
}
}
if (!length(grep(paste0("^", repo_wd), np)))
return(p)
sub(paste0("^", repo_wd), "", np)
}, character(1))
Browse[3]> path
[1] "bin/windows/contrib/3.4/drat_0.1.4.zip"
Browse[3]> n
debug: .Call(git2r_index_add_all, repo, path, force)
Browse[3]> path
bin/windows/contrib/3.4/drat_0.1.4.zip
"bin/windows/contrib/3.4/bin/windows/contrib/3.4/drat_0.1.4.zip"
Browse[3]> n
debug: invisible(NULL)
Browse[3]> git2r::status(repo)
Untracked files:
Untracked: bin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment