Skip to content

Conversation

@r-ash
Copy link
Contributor

@r-ash r-ash commented Dec 22, 2021

I've put this error in as soon as we list the paths to fail early. And not removed the

stopifnot(all(vlapply(split(files, files$hash), function(x)
    all(x$inode_first == x$inode[[1]]))))

which is what Oli has been seeing error previously. I can remove it if you think no longer relevant

@r-ash r-ash requested a review from richfitz December 22, 2021 09:21
R/deduplicate.R Outdated
fsep = "/")

paths <- file.path(config$root, "archive", files$path)
exists <- vlapply(paths, file.exists)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder about looking for the existence of file.path(config$root, "metadata") (or perhaps that there is at least one file within that directory); that would be stricter and easier to check? What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to fail with a specific message for people who have done a pull with recursive = FALSE then this works. People could still be in a state where they get a not very informative error later though from the stopifnot call. Say if they have deleted a report but not rebuilt the database.

R/deduplicate.R Outdated
paths <- file.path(config$root, "archive", files$path)
exists <- vlapply(paths, file.exists)
if (any(!exists)) {
stop(paste0("Cannot deduplicate archive as database references files ",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nicer to construct with paste and drop the trailing whitespace at the end of each string

@codecov
Copy link

codecov bot commented Dec 23, 2021

Codecov Report

Merging #308 (9fd642d) into master (da6bd5d) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #308   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           41        41           
  Lines         4473      4480    +7     
=========================================
+ Hits          4473      4480    +7     
Impacted Files Coverage Δ
R/deduplicate.R 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da6bd5d...9fd642d. Read the comment docs.

@r-ash r-ash requested a review from richfitz December 23, 2021 17:27
@richfitz richfitz merged commit 33a6e80 into master Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants