Skip to content

Commit

Permalink
allow git operations to work on absolute file path
Browse files Browse the repository at this point in the history
amending previous 'fix' for eddelbuettel#7
  • Loading branch information
shabbychef committed Mar 4, 2015
1 parent c44eecd commit ade5754
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/insertPackage.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit ade5754

Please sign in to comment.