Skip to content

Commit 47c381a

Browse files
here::here() is dangerous after setwd() and git2r::status() does not list all files in staged, so let's just use plain file filter for new repo
1 parent c0633f6 commit 47c381a

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

API

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Exported functions
44

55
autoupdate(root = here::here())
6-
diff_requires_run_roxygenize(root = here::here())
6+
diff_requires_run_roxygenize(root = ".")
77
dirs_R.cache(hook_id)
88
install_precommit(force = FALSE)
99
may_require_permanent_cache(temp_cache_is_enough = FALSE)

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ Roxygen: list(markdown = TRUE, roclets = c( "rd", "namespace", "collate",
4848
if (rlang::is_installed("pkgapi")) "pkgapi::api_roclet" else {
4949
warning("Please install r-lib/pkgapi to make sure the file API is kept
5050
up to date"); NULL} ) )
51-
RoxygenNote: 7.2.0
51+
RoxygenNote: 7.2.1
5252
SystemRequirements: git

R/roxygen2.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ extract_diff_files <- function(files) {
2424
#' hook such as [roxygen2::roxygenize()] must run at all or not.
2525
#' @param root The root of project.
2626
#' @keywords internal
27-
extract_diff_root <- function(root = here::here()) {
27+
extract_diff_root <- function(root = ".") {
2828
assert_is_git_repo(root)
2929
repo <- git2r::repository(root)
3030
if (length(git2r::reflog(repo)) == 0) {
3131
# nothing committed yet
32-
all_files <- git2r::status()$staged
32+
all_r_source_files <- list.files("R/", full.names = TRUE)
3333

34-
purrr::map(all_files[grepl("^R/.*\\.[Rr]$", all_files)], readLines) %>%
34+
purrr::map(all_r_source_files, readLines) %>%
3535
unlist() %>%
3636
unname()
3737
} else {
@@ -57,7 +57,7 @@ extract_diff_root <- function(root = here::here()) {
5757
#' diff_requires_run_roxygenize()
5858
#' }
5959
#' @export
60-
diff_requires_run_roxygenize <- function(root = here::here()) {
60+
diff_requires_run_roxygenize <- function(root = ".") {
6161
if (rlang::with_handlers(withr::with_namespace("git2r", FALSE), error = function(...) TRUE)) {
6262
generic <- paste0(
6363
" Please add the package as a dependency to ",

man/diff_requires_run_roxygenize.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/extract_diff_root.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)