Skip to content

Commit

Permalink
bump v 9012; submodules again
Browse files Browse the repository at this point in the history
  • Loading branch information
Eliot McIntire committed Oct 22, 2024
1 parent 17c81d4 commit f2755db
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ URL:
https://spades-project.predictiveecology.org/,
https://github.com/PredictiveEcology/SpaDES.project
Date: 2024-10-22
Version: 0.1.0.9010
Version: 0.1.0.9012
Authors@R: c(
person("Eliot J B", "McIntire", email = "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6914-8316")),
Expand Down
38 changes: 20 additions & 18 deletions R/setupProject.R
Original file line number Diff line number Diff line change
Expand Up @@ -1382,39 +1382,41 @@ setupModules <- function(name, paths, modules, inProject, useGit = getOption("Sp

reportBranch <- TRUE
# if (!grepl("master|main|HEAD", split$br)) {
prev <- setwd(file.path(paths[["modulePath"]], split$repo))
curBr <- gert::git_branch()
# prev <- setwd(file.path(paths[["modulePath"]], split$repo))
# curBr <- gert::git_branch()

# cmd <- "git rev-parse --abbrev-ref HEAD"
# curBr <- system(cmd, intern = TRUE)
if (!identical(split$br, curBr)) {
prev <- setwd(file.path(paths[["modulePath"]], split$repo))
gert::git_branch_checkout(split$br)
# cmd <- paste0("git checkout ", split$br)
# system(cmd)
reportBranch <- FALSE
}
gert::git_pull()
# }
# cmd <- paste0("git pull")
# system(cmd)

if (reportBranch)
messageVerbose("\b ... on ", split$br, " branch")
} else {
if (nzchar(Sys.which("git"))) {
cmd <- paste0("git submodule init")
system(cmd)
submod <- file.path(basename(paths[["modulePath"]]), split$repo)
gert::git_submodule_init(submod)#)
out <- try(gert::git_submodule_fetch(submodule = submod))
if (is(out, 'try-error')) {
cmd <- paste0("git submodule update --recursive")
system(cmd)
} else {
stop("To use git submodules, ", .messages$pleaseInstall())
}
# messageVerbose("module exists at ", localPath, "; not cloning", verbose = verbose)

}

})
messageVerbose("You will likely have to commit changes to git repository now", verbose = verbose)
# prev <- setwd(file.path(paths[["modulePath"]], split$repo))
# curBr <- gert::git_branch()
# if (!identical(split$br, curBr)) {
# prev <- setwd(file.path(paths[["modulePath"]], split$repo))
# gert::git_submodule_set_to(submod, ref = split$br)
# # cmd <- paste0("git checkout ", split$br)
# # system(cmd)
# reportBranch <- FALSE
# }
gert::git_pull()

})
# messageVerbose("You will likely have to commit changes to git repository now", verbose = verbose)
}
if (is.character(useGit) && isLocalGitRepoAlready %in% FALSE) {

Expand Down

0 comments on commit f2755db

Please sign in to comment.