@@ -234,7 +234,7 @@ build_git_demo <- function() {
234234 archive
235235}
236236
237- unzip_git_demo <- function (path = tempfile()) {
237+ unzip_git_demo <- function (path = tempfile(), default_branch = " master " ) {
238238 tmp <- tempfile()
239239 dir.create(tmp , FALSE , TRUE )
240240 demo <- getOption(" orderly.server.demo" , build_git_demo())
@@ -244,25 +244,22 @@ unzip_git_demo <- function(path = tempfile()) {
244244 no.. = TRUE )
245245 file_copy(src , path , recursive = TRUE )
246246 unlink(tmp , recursive = TRUE )
247+ if (default_branch != " master" ) {
248+ # # If git changes it's mind about what the default branch is called,
249+ # # this will fail, we should probably detect this, but it's likely
250+ # # that will break build_git_demo too
251+ gert :: git_branch_move(" master" , default_branch , force = TRUE ,
252+ repo = path )
253+ }
247254 path
248255}
249256
250257prepare_orderly_git_example <- function (path = tempfile(), run_report = FALSE ,
251258 branch = default_branch ,
252259 default_branch = " master" ) {
253260 path_upstream <- file.path(path , " upstream" )
254- unzip_git_demo(path )
255- unzip_git_demo(path_upstream )
256-
257- # # If git changes it's mind about what the default branch is called,
258- # # this will fail, we should probably detect this, but it's likely
259- # # that will break the unzip_git_demo/build_git functions too.
260- if (default_branch != " master" ) {
261- gert :: git_branch_move(" master" , default_branch , force = TRUE ,
262- repo = path )
263- gert :: git_branch_move(" master" , default_branch , force = TRUE ,
264- repo = path_upstream )
265- }
261+ unzip_git_demo(path , default_branch )
262+ unzip_git_demo(path_upstream , default_branch )
266263
267264 git_checkout_branch(branch , root = path )
268265 git_checkout_branch(branch , root = path_upstream )
0 commit comments