Skip to content

Commit

Permalink
guard against NA mtime values in auto snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinushey committed Nov 27, 2023
1 parent 3f7cd47 commit 11adabe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions R/snapshot-auto.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ renv_snapshot_auto_impl <- function(project) {
renv.verbose = FALSE
)

# file.info() can warn in some cases; silence those
renv_scope_options(warn = 0L)

# get current lockfile state
lockfile <- renv_paths_lockfile(project)
old <- file.info(lockfile, extra_cols = FALSE)$mtime
Expand All @@ -60,7 +63,7 @@ renv_snapshot_auto_impl <- function(project) {

# check for change in lockfile
new <- file.info(lockfile, extra_cols = FALSE)$mtime
old != new
!identical(old, new)

}

Expand Down Expand Up @@ -167,7 +170,11 @@ renv_snapshot_task_impl <- function() {
return(invisible(FALSE))

# library has updated; perform auto snapshot
renv_snapshot_auto(project = project)
status <- renv_snapshot_auto(project = project)
ok <- identical(status, TRUE)

# return invisibly for snapshot tests
invisible(ok)

}

Expand Down

0 comments on commit 11adabe

Please sign in to comment.