Setup a git worktree for concurrent manipulation of a separate branch
Source:R/utils-git.R
git_worktree.Rd
Setup a git worktree for concurrent manipulation of a separate branch
Usage
git_worktree_setup(
path = ".",
dest_dir,
branch = "gh-pages",
remote = "origin",
throwaway = FALSE
)
github_worktree_commit(dir, commit_message, remote, branch)
github_worktree_remove(dir, home = NULL)
Arguments
- path
path to the repository
- dest_dir
path to the destination directory to contain the work tree
- branch
the branch associated with the work tree (default: gh-pages)
- remote
the remote name (default: origin)
- throwaway
if
TRUE
, the worktree created is in a detached HEAD state from from the remote branch and will not create a new branch in your repository. Defaults toFALSE
, which will create the branch from upstream.
Value
an expression()
that calls git worktree remove
on the worktree
when evaluated.
Details
This function is used in continuous integration settings where we want to push derived outputs to non-main branches in our repository. We use this to populate the markdown and HTML outputs from the lesson so that we don't have to rebuild the lesson from scratch every time.
The logic behind this looks like
worktree setup
[IF BRANCH DOES NOT EXIST]
git checkout --orphan <branch>
git rm -rf --quiet .
git commit --allow-empty -m
git push remote HEAD:<branch>
git checkout -
git fetch <remote> +refs/heads/<branch>:refs/remotes/<remote>/<branch>
git worktree add --track -B <branch> /path/to/dir <remote>/<branch>
Note
git_worktree_setup()
has been modified from the logic in
pkgdown::deploy_to_branch()
, by Hadley Wickham.
github_worktree_commit()
: Modified from pkgdown:::github_push
by Hadley
Wickham
github_worktree_remove()
: Modified from pkgdown:::github_worktree_remove
by Hadley Wickham
Examples
# Use Worktrees to deploy a lesson -----------------------------------------
# This example is a bit inovlved, but it is effectively what we do inside of
# the `ci_deploy()` function (after setting up the lesson).
#
# The setup phase will create a new lesson and a corresponding remote (self
# contained, no GitHub authentication required).
#
# The worktrees will be created for both the markdown and HTML outputs on the
# branches "md-outputs" and "gh-pages", respectively.
#
# After the worktrees are created, we will build the lesson into the
# worktrees and display the output of `git_status()` for each of the three
# branches: "main", "md-outputs", and "gh-pages"
#
# During the clean up phase, the output of `git_worktree_setup()` is
# evaluated
tik <- Sys.time()
cli::cli_h1("Set up")
#>
#> ── Set up ──────────────────────────────────────────────────────────────
cli::cli_h2("Create Lesson")
#>
#> ── Create Lesson ──
#>
restore_fixture <- sandpaper:::create_test_lesson()
#> → Bootstrapping example lesson
#> - The project is out-of-sync -- use `renv::status()` for details.
#> → Searching for and installing available dependencies
#> The following packages were discovered:
#>
#> # ~/work/_temp/Library -------------------------------------------------------
#> - R6 2.5.1
#> - base64enc 0.1-3
#> - bslib 0.7.0
#> - cachem 1.1.0
#> - cli 3.6.3
#> - digest 0.6.36
#> - evaluate 0.24.0
#> - fastmap 1.2.0
#> - fontawesome 0.5.2
#> - fs 1.6.4
#> - glue 1.7.0
#> - highr 0.11
#> - htmltools 0.5.8.1
#> - jquerylib 0.1.4
#> - jsonlite 1.8.8
#> - knitr 1.48
#> - lifecycle 1.0.4
#> - memoise 2.0.1
#> - mime 0.12
#> - rappdirs 0.3.3
#> - rlang 1.1.4
#> - rmarkdown 2.27
#> - sass 0.4.9
#> - tinytex 0.52
#> - xfun 0.46
#> - yaml 2.3.10
#>
#> They will be copied into the project library.
#>
#> - Copying packages into the project library ... Done!
#> - Hydrated 26 packages in 0.22 seconds.
#> - Resolving missing dependencies ...
#> # Installing packages --------------------------------------------------------
#> - The project is out-of-sync -- use `renv::status()` for details.
#> → Recording changes in lockfile
#> The following package(s) will be updated in the lockfile:
#>
#> # GitHub ---------------------------------------------------------------------
#> - renv [* -> rstudio/renv]
#>
#> # https://packagemanager.posit.co/cran/__linux__/jammy/latest ----------------
#> - R6 [* -> 2.5.1]
#> - base64enc [* -> 0.1-3]
#> - bslib [* -> 0.7.0]
#> - cachem [* -> 1.1.0]
#> - cli [* -> 3.6.3]
#> - digest [* -> 0.6.36]
#> - evaluate [* -> 0.24.0]
#> - fastmap [* -> 1.2.0]
#> - fontawesome [* -> 0.5.2]
#> - fs [* -> 1.6.4]
#> - glue [* -> 1.7.0]
#> - highr [* -> 0.11]
#> - htmltools [* -> 0.5.8.1]
#> - jquerylib [* -> 0.1.4]
#> - jsonlite [* -> 1.8.8]
#> - knitr [* -> 1.48]
#> - lifecycle [* -> 1.0.4]
#> - memoise [* -> 2.0.1]
#> - mime [* -> 0.12]
#> - rappdirs [* -> 0.3.3]
#> - rlang [* -> 1.1.4]
#> - rmarkdown [* -> 2.27]
#> - sass [* -> 0.4.9]
#> - tinytex [* -> 0.52]
#> - xfun [* -> 0.46]
#> - yaml [* -> 2.3.10]
#>
#> The version of R recorded in the lockfile will be updated:
#> - R [* -> 4.4.1]
#>
#> - Lockfile written to "/tmp/RtmpP9eYUD/file19325ff475ce/lesson-example/renv/profiles/lesson-requirements/renv.lock".
res <- getOption("sandpaper.test_fixture")
sandpaper:::check_git_user(res)
cli::cli_h2("Create Remote")
#>
#> ── Create Remote ──
#>
rmt <- fs::file_temp(pattern = "REMOTE-")
sandpaper:::setup_local_remote(repo = res, remote = rmt, verbose = FALSE)
tok <- Sys.time()
cli::cli_alert_info("Elapsed time: {round(tok - tik, 2)} seconds")
#> ℹ Elapsed time: 3.03 seconds
tik <- Sys.time()
cli::cli_h2("Create Worktrees")
#>
#> ── Create Worktrees ──
#>
db <- sandpaper:::git_worktree_setup(res, fs::path(res, "site", "built"),
branch = "md-outputs", remote = "sandpaper-local"
)
#> ::group::Create New Branch
#> Running git checkout --orphan md-outputs
#> Switched to a new branch 'md-outputs'
#> Running git rm -rf --quiet .
#> Running git commit --allow-empty -m 'Initializing md-outputs branch'
#> [md-outputs (root-commit) e907665] Initializing md-outputs branch
#> Running git push sandpaper-local 'HEAD:md-outputs'
#> To /tmp/RtmpP9eYUD/REMOTE-193265489c3a
#> * [new branch] HEAD -> md-outputs
#> Running git checkout main
#> Switched to branch 'main'
#> Your branch is up to date with 'sandpaper-local/main'.
#> ::endgroup::
#> ::group::Fetch sandpaper-local/md-outputs
#> Running git remote set-branches sandpaper-local md-outputs
#> Running git fetch sandpaper-local md-outputs
#> From /tmp/RtmpP9eYUD/REMOTE-193265489c3a
#> * branch md-outputs -> FETCH_HEAD
#> Running git remote set-branches sandpaper-local '*'
#> ::endgroup::
#> ::group::Add worktree for sandpaper-local/md-outputs in site/built
#> Running git worktree add --track -B md-outputs \
#> /tmp/RtmpP9eYUD/file19325ff475ce/lesson-example/site/built \
#> sandpaper-local/md-outputs
#> Preparing worktree (resetting branch 'md-outputs'; was at e907665)
#> branch 'md-outputs' set up to track 'sandpaper-local/md-outputs'.
#> HEAD is now at e907665 Initializing md-outputs branch
#> ::endgroup::
ds <- sandpaper:::git_worktree_setup(res, fs::path(res, "site", "docs"),
branch = "gh-pages", remote = "sandpaper-local"
)
#> ::group::Create New Branch
#> Running git checkout --orphan gh-pages
#> Switched to a new branch 'gh-pages'
#> Running git rm -rf --quiet .
#> Running git commit --allow-empty -m 'Initializing gh-pages branch'
#> [gh-pages (root-commit) 9ca8e49] Initializing gh-pages branch
#> Running git push sandpaper-local 'HEAD:gh-pages'
#> To /tmp/RtmpP9eYUD/REMOTE-193265489c3a
#> * [new branch] HEAD -> gh-pages
#> Running git checkout main
#> Switched to branch 'main'
#> Your branch is up to date with 'sandpaper-local/main'.
#> ::endgroup::
#> ::group::Fetch sandpaper-local/gh-pages
#> Running git remote set-branches sandpaper-local gh-pages
#> Running git fetch sandpaper-local gh-pages
#> From /tmp/RtmpP9eYUD/REMOTE-193265489c3a
#> * branch gh-pages -> FETCH_HEAD
#> Running git remote set-branches sandpaper-local '*'
#> ::endgroup::
#> ::group::Add worktree for sandpaper-local/gh-pages in site/docs
#> Running git worktree add --track -B gh-pages \
#> /tmp/RtmpP9eYUD/file19325ff475ce/lesson-example/site/docs \
#> sandpaper-local/gh-pages
#> Preparing worktree (resetting branch 'gh-pages'; was at 9ca8e49)
#> branch 'gh-pages' set up to track 'sandpaper-local/gh-pages'.
#> HEAD is now at 9ca8e49 Initializing gh-pages branch
#> ::endgroup::
tok <- Sys.time()
cli::cli_alert_info("Elapsed time: {round(tok - tik, 2)} seconds")
#> ℹ Elapsed time: 0.36 seconds
tik <- Sys.time()
cli::cli_h1("Build Lesson into worktrees")
#>
#> ── Build Lesson into worktrees ─────────────────────────────────────────
build_lesson(res, quiet = TRUE, preview = FALSE)
#> ! There were errors in 13/37 links
#> ◌ Links must use HTTPS <https://https.cio.gov/everything/>
#> ◌ Some linked internal files do not exist <https://carpentries.github.io/sandpaper/articles/include-child-documents.html#workspace-consideration>
#>
#> ::warning file=CONTRIBUTING.md,line=3:: [needs HTTPS]: [Software Carpentry](http://software-carpentry.org/)
#> ::warning file=CONTRIBUTING.md,line=3:: [needs HTTPS]: [Data Carpentry](http://datacarpentry.org/)
#> ::warning file=CONTRIBUTING.md,line=17:: [needs HTTPS]: [Software Carpentry](http://software-carpentry.org/)
#> ::warning file=CONTRIBUTING.md,line=17:: [needs HTTPS]: [Data Carpentry](http://datacarpentry.org/)
#> ::warning file=CONTRIBUTING.md,line=18:: [missing file]: [code of conduct](CONDUCT.md)
#> ::warning file=CONTRIBUTING.md,line=29:: [needs HTTPS]: [GitHub](http://github.com)
#> ::warning file=CONTRIBUTING.md,line=34:: [needs HTTPS]: [GitHub](http://github.com)
#> ::warning file=CONTRIBUTING.md,line=114:: [needs HTTPS]: [Software Carpentry](http://software-carpentry.org/)
#> ::warning file=CONTRIBUTING.md,line=114:: [needs HTTPS]: [Data Carpentry](http://datacarpentry.org/)
#> ::warning file=CONTRIBUTING.md,line=115:: [needs HTTPS]: [discussion mailing list](http://lists.software-carpentry.org/listinfo/discuss)
#> ::warning file=LICENSE.md,line=28:: [needs HTTPS]: [http://software-carpentry.org/](http://software-carpentry.org/)
#> ::warning file=LICENSE.md,line=76:: [needs HTTPS]: [Community Initiatives](http://communityin.org/)
#> ::warning file=learners/setup.md,line=10:: [missing file]: [data zip file](data/data.zip)
#> ── Initialising site ───────────────────────────────────────────────────
#> Copying <pkgdown>/BS3/assets/bootstrap-toc.css to bootstrap-toc.css
#> Copying <pkgdown>/BS3/assets/bootstrap-toc.js to bootstrap-toc.js
#> Copying <pkgdown>/BS3/assets/docsearch.css to docsearch.css
#> Copying <pkgdown>/BS3/assets/docsearch.js to docsearch.js
#> Copying <pkgdown>/BS3/assets/link.svg to link.svg
#> Copying <pkgdown>/BS3/assets/pkgdown.css to pkgdown.css
#> Copying <pkgdown>/BS3/assets/pkgdown.js to pkgdown.js
#> Copying <varnish>/pkgdown/assets/android-chrome-192x192.png to
#> android-chrome-192x192.png
#> Copying <varnish>/pkgdown/assets/android-chrome-512x512.png to
#> android-chrome-512x512.png
#> Copying <varnish>/pkgdown/assets/apple-touch-icon.png to
#> apple-touch-icon.png
#> Copying <varnish>/pkgdown/assets/assets/fonts/Mulish-Bold.ttf to
#> assets/fonts/Mulish-Bold.ttf
#> Copying <varnish>/pkgdown/assets/assets/fonts/Mulish-Bold.woff to
#> assets/fonts/Mulish-Bold.woff
#> Copying <varnish>/pkgdown/assets/assets/fonts/Mulish-ExtraBold.ttf to
#> assets/fonts/Mulish-ExtraBold.ttf
#> Copying
#> <varnish>/pkgdown/assets/assets/fonts/mulish-v5-latin-regular.eot to
#> assets/fonts/mulish-v5-latin-regular.eot
#> Copying
#> <varnish>/pkgdown/assets/assets/fonts/mulish-v5-latin-regular.svg to
#> assets/fonts/mulish-v5-latin-regular.svg
#> Copying
#> <varnish>/pkgdown/assets/assets/fonts/mulish-v5-latin-regular.ttf to
#> assets/fonts/mulish-v5-latin-regular.ttf
#> Copying
#> <varnish>/pkgdown/assets/assets/fonts/mulish-v5-latin-regular.woff to
#> assets/fonts/mulish-v5-latin-regular.woff
#> Copying
#> <varnish>/pkgdown/assets/assets/fonts/mulish-v5-latin-regular.woff2 to
#> assets/fonts/mulish-v5-latin-regular.woff2
#> Copying
#> <varnish>/pkgdown/assets/assets/fonts/mulish-variablefont_wght.woff to
#> assets/fonts/mulish-variablefont_wght.woff
#> Copying
#> <varnish>/pkgdown/assets/assets/fonts/mulish-variablefont_wght.woff2 to
#> assets/fonts/mulish-variablefont_wght.woff2
#> Copying <varnish>/pkgdown/assets/assets/images/carpentries-logo-sm.svg
#> to assets/images/carpentries-logo-sm.svg
#> Copying <varnish>/pkgdown/assets/assets/images/carpentries-logo.svg to
#> assets/images/carpentries-logo.svg
#> Copying <varnish>/pkgdown/assets/assets/images/data-logo-sm.svg to
#> assets/images/data-logo-sm.svg
#> Copying <varnish>/pkgdown/assets/assets/images/data-logo.svg to
#> assets/images/data-logo.svg
#> Copying <varnish>/pkgdown/assets/assets/images/dropdown-arrow.svg to
#> assets/images/dropdown-arrow.svg
#> Copying <varnish>/pkgdown/assets/assets/images/incubator-logo-sm.svg to
#> assets/images/incubator-logo-sm.svg
#> Copying <varnish>/pkgdown/assets/assets/images/incubator-logo.svg to
#> assets/images/incubator-logo.svg
#> Copying <varnish>/pkgdown/assets/assets/images/lab-logo-sm.svg to
#> assets/images/lab-logo-sm.svg
#> Copying <varnish>/pkgdown/assets/assets/images/lab-logo.svg to
#> assets/images/lab-logo.svg
#> Copying <varnish>/pkgdown/assets/assets/images/library-logo-sm.svg to
#> assets/images/library-logo-sm.svg
#> Copying <varnish>/pkgdown/assets/assets/images/library-logo.svg to
#> assets/images/library-logo.svg
#> Copying <varnish>/pkgdown/assets/assets/images/minus.svg to
#> assets/images/minus.svg
#> Copying <varnish>/pkgdown/assets/assets/images/plus.svg to
#> assets/images/plus.svg
#> Copying <varnish>/pkgdown/assets/assets/images/software-logo-sm.svg to
#> assets/images/software-logo-sm.svg
#> Copying <varnish>/pkgdown/assets/assets/images/software-logo.svg to
#> assets/images/software-logo.svg
#> Copying <varnish>/pkgdown/assets/assets/scripts.js to assets/scripts.js
#> Copying <varnish>/pkgdown/assets/assets/styles.css to assets/styles.css
#> Copying <varnish>/pkgdown/assets/assets/styles.css.map to
#> assets/styles.css.map
#> Copying <varnish>/pkgdown/assets/assets/themetoggle.js to
#> assets/themetoggle.js
#> Copying <varnish>/pkgdown/assets/favicon-16x16.png to favicon-16x16.png
#> Copying <varnish>/pkgdown/assets/favicon-32x32.png to favicon-32x32.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/cp/apple-touch-icon-114x114.png to
#> favicons/cp/apple-touch-icon-114x114.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/cp/apple-touch-icon-120x120.png to
#> favicons/cp/apple-touch-icon-120x120.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/cp/apple-touch-icon-144x144.png to
#> favicons/cp/apple-touch-icon-144x144.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/cp/apple-touch-icon-152x152.png to
#> favicons/cp/apple-touch-icon-152x152.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/apple-touch-icon-57x57.png
#> to favicons/cp/apple-touch-icon-57x57.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/apple-touch-icon-60x60.png
#> to favicons/cp/apple-touch-icon-60x60.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/apple-touch-icon-72x72.png
#> to favicons/cp/apple-touch-icon-72x72.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/apple-touch-icon-76x76.png
#> to favicons/cp/apple-touch-icon-76x76.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/favicon-128.png to
#> favicons/cp/favicon-128.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/favicon-16x16.png to
#> favicons/cp/favicon-16x16.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/favicon-196x196.png to
#> favicons/cp/favicon-196x196.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/favicon-32x32.png to
#> favicons/cp/favicon-32x32.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/favicon-96x96.png to
#> favicons/cp/favicon-96x96.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/favicon.ico to
#> favicons/cp/favicon.ico
#> Copying <varnish>/pkgdown/assets/favicons/cp/mstile-144x144.png to
#> favicons/cp/mstile-144x144.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/mstile-150x150.png to
#> favicons/cp/mstile-150x150.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/mstile-310x150.png to
#> favicons/cp/mstile-310x150.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/mstile-310x310.png to
#> favicons/cp/mstile-310x310.png
#> Copying <varnish>/pkgdown/assets/favicons/cp/mstile-70x70.png to
#> favicons/cp/mstile-70x70.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/dc/apple-touch-icon-114x114.png to
#> favicons/dc/apple-touch-icon-114x114.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/dc/apple-touch-icon-120x120.png to
#> favicons/dc/apple-touch-icon-120x120.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/dc/apple-touch-icon-144x144.png to
#> favicons/dc/apple-touch-icon-144x144.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/dc/apple-touch-icon-152x152.png to
#> favicons/dc/apple-touch-icon-152x152.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/apple-touch-icon-57x57.png
#> to favicons/dc/apple-touch-icon-57x57.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/apple-touch-icon-60x60.png
#> to favicons/dc/apple-touch-icon-60x60.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/apple-touch-icon-72x72.png
#> to favicons/dc/apple-touch-icon-72x72.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/apple-touch-icon-76x76.png
#> to favicons/dc/apple-touch-icon-76x76.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/favicon-128.png to
#> favicons/dc/favicon-128.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/favicon-16x16.png to
#> favicons/dc/favicon-16x16.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/favicon-196x196.png to
#> favicons/dc/favicon-196x196.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/favicon-32x32.png to
#> favicons/dc/favicon-32x32.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/favicon-96x96.png to
#> favicons/dc/favicon-96x96.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/favicon.ico to
#> favicons/dc/favicon.ico
#> Copying <varnish>/pkgdown/assets/favicons/dc/mstile-144x144.png to
#> favicons/dc/mstile-144x144.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/mstile-150x150.png to
#> favicons/dc/mstile-150x150.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/mstile-310x150.png to
#> favicons/dc/mstile-310x150.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/mstile-310x310.png to
#> favicons/dc/mstile-310x310.png
#> Copying <varnish>/pkgdown/assets/favicons/dc/mstile-70x70.png to
#> favicons/dc/mstile-70x70.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/lc/apple-touch-icon-114x114.png to
#> favicons/lc/apple-touch-icon-114x114.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/lc/apple-touch-icon-120x120.png to
#> favicons/lc/apple-touch-icon-120x120.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/lc/apple-touch-icon-144x144.png to
#> favicons/lc/apple-touch-icon-144x144.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/lc/apple-touch-icon-152x152.png to
#> favicons/lc/apple-touch-icon-152x152.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/apple-touch-icon-57x57.png
#> to favicons/lc/apple-touch-icon-57x57.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/apple-touch-icon-60x60.png
#> to favicons/lc/apple-touch-icon-60x60.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/apple-touch-icon-72x72.png
#> to favicons/lc/apple-touch-icon-72x72.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/apple-touch-icon-76x76.png
#> to favicons/lc/apple-touch-icon-76x76.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/favicon-128.png to
#> favicons/lc/favicon-128.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/favicon-16x16.png to
#> favicons/lc/favicon-16x16.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/favicon-196x196.png to
#> favicons/lc/favicon-196x196.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/favicon-32x32.png to
#> favicons/lc/favicon-32x32.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/favicon-96x96.png to
#> favicons/lc/favicon-96x96.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/favicon.ico to
#> favicons/lc/favicon.ico
#> Copying <varnish>/pkgdown/assets/favicons/lc/mstile-144x144.png to
#> favicons/lc/mstile-144x144.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/mstile-150x150.png to
#> favicons/lc/mstile-150x150.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/mstile-310x150.png to
#> favicons/lc/mstile-310x150.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/mstile-310x310.png to
#> favicons/lc/mstile-310x310.png
#> Copying <varnish>/pkgdown/assets/favicons/lc/mstile-70x70.png to
#> favicons/lc/mstile-70x70.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/swc/apple-touch-icon-114x114.png to
#> favicons/swc/apple-touch-icon-114x114.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/swc/apple-touch-icon-120x120.png to
#> favicons/swc/apple-touch-icon-120x120.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/swc/apple-touch-icon-144x144.png to
#> favicons/swc/apple-touch-icon-144x144.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/swc/apple-touch-icon-152x152.png to
#> favicons/swc/apple-touch-icon-152x152.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/swc/apple-touch-icon-57x57.png to
#> favicons/swc/apple-touch-icon-57x57.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/swc/apple-touch-icon-60x60.png to
#> favicons/swc/apple-touch-icon-60x60.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/swc/apple-touch-icon-72x72.png to
#> favicons/swc/apple-touch-icon-72x72.png
#> Copying
#> <varnish>/pkgdown/assets/favicons/swc/apple-touch-icon-76x76.png to
#> favicons/swc/apple-touch-icon-76x76.png
#> Copying <varnish>/pkgdown/assets/favicons/swc/favicon-128.png to
#> favicons/swc/favicon-128.png
#> Copying <varnish>/pkgdown/assets/favicons/swc/favicon-16x16.png to
#> favicons/swc/favicon-16x16.png
#> Copying <varnish>/pkgdown/assets/favicons/swc/favicon-196x196.png to
#> favicons/swc/favicon-196x196.png
#> Copying <varnish>/pkgdown/assets/favicons/swc/favicon-32x32.png to
#> favicons/swc/favicon-32x32.png
#> Copying <varnish>/pkgdown/assets/favicons/swc/favicon-96x96.png to
#> favicons/swc/favicon-96x96.png
#> Copying <varnish>/pkgdown/assets/favicons/swc/favicon.ico to
#> favicons/swc/favicon.ico
#> Copying <varnish>/pkgdown/assets/favicons/swc/mstile-144x144.png to
#> favicons/swc/mstile-144x144.png
#> Copying <varnish>/pkgdown/assets/favicons/swc/mstile-150x150.png to
#> favicons/swc/mstile-150x150.png
#> Copying <varnish>/pkgdown/assets/favicons/swc/mstile-310x150.png to
#> favicons/swc/mstile-310x150.png
#> Copying <varnish>/pkgdown/assets/favicons/swc/mstile-310x310.png to
#> favicons/swc/mstile-310x310.png
#> Copying <varnish>/pkgdown/assets/favicons/swc/mstile-70x70.png to
#> favicons/swc/mstile-70x70.png
#> Copying <varnish>/pkgdown/assets/mstile-150x150.png to
#> mstile-150x150.png
#> Copying <varnish>/pkgdown/assets/safari-pinned-tab.svg to
#> safari-pinned-tab.svg
#> Copying <varnish>/pkgdown/assets/site.webmanifest to site.webmanifest
cli::cli_h2("git status: {gert::git_branch(repo = res)}")
#>
#> ── git status: main ──
#>
print(gert::git_status(repo = res))
#> # A tibble: 0 × 3
#> # ℹ 3 variables: file <chr>, status <chr>, staged <lgl>
cli::cli_h2('git status: {gert::git_branch(repo = fs::path(res, "site", "built"))}')
#> ── git status: md-outputs ──
#>
print(gert::git_status(repo = fs::path(res, "site", "built")))
#> # A tibble: 12 × 3
#> file status staged
#> <chr> <chr> <lgl>
#> 1 CODE_OF_CONDUCT.md new FALSE
#> 2 LICENSE.md new FALSE
#> 3 config.yaml new FALSE
#> 4 fig/ new FALSE
#> 5 index.md new FALSE
#> 6 instructor-notes.md new FALSE
#> 7 introduction.md new FALSE
#> 8 learner-profiles.md new FALSE
#> 9 links.md new FALSE
#> 10 md5sum.txt new FALSE
#> 11 renv.lock new FALSE
#> 12 setup.md new FALSE
cli::cli_h2('git status: {gert::git_branch(repo = fs::path(res, "site", "docs"))}')
#> ── git status: gh-pages ──
#>
print(gert::git_status(repo = fs::path(res, "site", "docs")))
#> # A tibble: 34 × 3
#> file status staged
#> <chr> <chr> <lgl>
#> 1 .nojekyll new FALSE
#> 2 CODE_OF_CONDUCT.html new FALSE
#> 3 LICENSE.html new FALSE
#> 4 aio.html new FALSE
#> 5 android-chrome-192x192.png new FALSE
#> 6 android-chrome-512x512.png new FALSE
#> 7 apple-touch-icon.png new FALSE
#> 8 assets/ new FALSE
#> 9 bootstrap-toc.css new FALSE
#> 10 bootstrap-toc.js new FALSE
#> # ℹ 24 more rows
tok <- Sys.time()
cli::cli_alert_info("Elapsed time: {round(tok - tik, 2)} seconds")
#> ℹ Elapsed time: 11.01 seconds
tik <- Sys.time()
cli::cli_h1("Clean Up")
#>
#> ── Clean Up ────────────────────────────────────────────────────────────
cli::cli_alert_info("object db is an expression that evaluates to {.code {db}}")
#> ℹ object db is an expression that evaluates to `sandpaper:::github_worktree_remove("/tmp/RtmpP9eYUD/file19325ff475ce/lesson-example/site/built", "/tmp/RtmpP9eYUD/file19325ff475ce/lesson-example")`
eval(db)
#> Running git worktree remove --force \
#> /tmp/RtmpP9eYUD/file19325ff475ce/lesson-example/site/built
#> $status
#> [1] 0
#>
#> $stdout
#> [1] ""
#>
#> $stderr
#> [1] ""
#>
#> $timeout
#> [1] FALSE
#>
cli::cli_alert_info("object ds is an expression that evaluates to {.code {ds}}")
#> ℹ object ds is an expression that evaluates to `sandpaper:::github_worktree_remove("/tmp/RtmpP9eYUD/file19325ff475ce/lesson-example/site/docs", "/tmp/RtmpP9eYUD/file19325ff475ce/lesson-example")`
eval(ds)
#> Running git worktree remove --force \
#> /tmp/RtmpP9eYUD/file19325ff475ce/lesson-example/site/docs
#> $status
#> [1] 0
#>
#> $stdout
#> [1] ""
#>
#> $stderr
#> [1] ""
#>
#> $timeout
#> [1] FALSE
#>
sandpaper:::remove_local_remote(repo = res)
#> /tmp/RtmpP9eYUD/REMOTE-193265489c3a
sandpaper:::reset_git_user(res)
# remove the test fixture and report
tryCatch(fs::dir_delete(res), error = function() FALSE)
tok <- Sys.time()
cli::cli_alert_info("Elapsed time: {round(tok - tik, 2)} seconds")
#> ℹ Elapsed time: 0.14 seconds