From ade575484803f9cd69d3a060dc9924813a5433e8 Mon Sep 17 00:00:00 2001 From: "Steven E. Pav" Date: Wed, 4 Mar 2015 12:58:07 -0800 Subject: [PATCH] allow git operations to work on absolute file path amending previous 'fix' for #7 --- R/insertPackage.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/R/insertPackage.R b/R/insertPackage.R index 9691622e..df440b94 100644 --- a/R/insertPackage.R +++ b/R/insertPackage.R @@ -61,20 +61,22 @@ insertPackage <- function(file, write_PACKAGES(srcdir, type="source") ## TODO: generalize to binary + package_tgz <- basename(file) + if (commit) { if (haspkg) { repo <- git2r::repository(repodir) setwd(srcdir) - git2r::add(repo, file.path("src", "contrib", file)) + git2r::add(repo, file.path("src", "contrib", package_tgz)) git2r::add(repo, file.path("src", "contrib", "PACKAGES")) git2r::add(repo, file.path("src", "contrib", "PACKAGES.gz")) - git2r::commit(repo, paste("adding", file, "to drat")) + git2r::commit(repo, paste("adding", package_tgz, "to drat")) # git2r::push(repo) } else if (hascmd) { setwd(srcdir) cmd <- sprintf(paste("git add %s PACKAGES PACKAGES.gz;", "git commit -m\"adding %s to drat\";", - "git push"), file, file) + "git push"), package_tgz, package_tgz) system(cmd) ## TODO: error checking } else { warning("Commit skipped as both git2r package and git command missing.",