Skip to content

Commit

Permalink
Force add docs/ and add to .gitignore (#237)
Browse files Browse the repository at this point in the history
* Files specified for deployment via `step_push_deploy(commit_paths = )` are now force added to the index by `git`. 
  This enables to add directories like `docs/` (e.g. created by a local pkgdown build) to `.gitignore` and still deploy it during CI.
  • Loading branch information
pat-s authored Mar 15, 2020
1 parent 3c54c98 commit 8ca6fab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ inst/doc
.DS_Store
.vscode
tests/testthat/tic
docs/
6 changes: 4 additions & 2 deletions R/steps-git.R
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,15 @@ DoPushDeploy <- R6Class(

commit = function() {
message("Staging: ", paste(private$commit_paths, collapse = ", "))
git2r::add(private$git$get_repo(), private$commit_paths)
git2r::add(private$git$get_repo(), private$commit_paths, force = TRUE)

message("Checking changed files")
status <- git2r::status(
private$git$get_repo(),
staged = TRUE,
unstaged = FALSE, untracked = FALSE, ignored = FALSE
unstaged = FALSE,
untracked = FALSE,
ignored = FALSE
)
if (length(status$staged) == 0) {
message("Nothing to commit!")
Expand Down
4 changes: 4 additions & 0 deletions R/use_tic.R
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ use_tic_r <- function(repo_type, deploy_on = "none") {
cli_end()
cli_h2("tic.R")

# if deploy is requested, we most likely build a pkgdown site and should
# ignore "docs/" here
usethis::use_git_ignore("docs/")

if (repo_type == "unknown") {
use_tic_template(file.path(
repo_type,
Expand Down

0 comments on commit 8ca6fab

Please sign in to comment.