Skip to contents

freeze() writes the md5 of each file of paths to the file manifest, in the format of md5sum. A rule can then find each file that changed after the freeze.

Usage

freeze(paths, manifest, home = ".")

Arguments

paths

The files and folders to freeze, relative to home.

manifest

The file to write, relative to home.

home

The folder that paths and manifest are relative to. The default "." is the working directory.

Value

The path manifest, invisibly.

Details

Each line of the manifest is "<md5> <path>", with two spaces, and ends with LF. <path> is relative to home. The lines are in the order of the paths, sorted in the C locale. In a file with the extension .R or .r, freeze() reads each CR LF as LF before it takes the md5. R parses the file the same either way, so a checkout with core.autocrlf = true gives the same manifest. Every other file gets the md5 of its bytes.

A folder in paths stands for each file under it, hidden files included. The manifest has no line for itself. freeze() writes over an older manifest, and it stops before it writes when a path does not exist.

Examples

home <- file.path(tempdir(), "checkit_freeze_example")
dir.create(file.path(home, "R"), recursive = TRUE)
writeLines("x <- 1", file.path(home, "run.R"))
writeLines("f <- function() return(1)", file.path(home, "R", "f.R"))
checkit::freeze(c("run.R", "R"), "frozen.md5", home = home)
readLines(file.path(home, "frozen.md5"))
#> [1] "6e5f7d320bb45e981dc6db489eb750ea  R/f.R"
#> [2] "7a520755d4be04115776fc6fbdff8e83  run.R"
unlink(home, recursive = TRUE)