Show all the data snapshots of a code branch.
Usage
tar_git_log(
code = getwd(),
store = targets::tar_config_get("store"),
branch = gert::git_branch(repo = code),
max = 100
)
Arguments
- code
Character of length 1, directory path to the code repository, usually the root of the
targets
project.- store
Character of length 1, path to the data store of the pipeline. If
NULL
, thestore
setting is left unchanged in the YAML configuration file (default:_targets.yaml
). Usually, the data store lives at_targets
. Setstore
to a custom directory to specify a path other than_targets/
. The path need not exist before the pipeline begins, and it need not end with "_targets", but it must be writeable. For optimal performance, choose a storage location with fast read/write access. If the argumentNULL
, the setting is not modified. Usetar_config_unset()
to delete a setting.- branch
Character of length 1, name of the code repository branch to query. Defaults to the currently checked-out code branch.
- max
Positive numeric of length 1, maximum number of code commits to inspect for the given branch.
Details
By design, tar_git_log()
only queries a single
code branch at a time. This allows tar_git_log()
to report more detailed information about the snapshots
of the given code branch.
To query all data snapshots over all branches, simply run
gert::git_branch_list(local = TRUE, repo = "_targets")
.
The valid snapshots show "code=<SHA1>"
in the name
column,
where <SHA1>
is the Git commit hash of the code commit
corresponding to the data snapshot.
See also
Other git:
tar_git_checkout()
,
tar_git_init()
,
tar_git_ok()
,
tar_git_snapshot()
,
tar_git_status_code()
,
tar_git_status_data()
,
tar_git_status_targets()
,
tar_git_status()
Examples
if (Sys.getenv("TAR_EXAMPLES") == "true" && tar_git_ok(verbose = FALSE)) {
targets::tar_dir({ # Containing code does not modify the user's filespace.
targets::tar_script(tar_target(data, 1))
targets::tar_make()
gert::git_init()
gert::git_add("_targets.R")
gert::git_commit("First commit")
tar_git_init()
tar_git_snapshot(status = FALSE, verbose = FALSE)
tar_git_log()
})
}