diff --git a/.github/workflows/pr_title.yml b/.github/workflows/pr_title.yml deleted file mode 100644 index 553db64..0000000 --- a/.github/workflows/pr_title.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: 'PR Title Checker' -on: - pull_request: - types: [edited, opened, synchronize, reopened] - branches: - - main - - master - -jobs: - title-check: - runs-on: ubuntu-latest - steps: - - uses: naveenk1223/action-pr-title@master - with: - regex: 'Version [0-9]+\.[0-9]+(\.[0-9]+)?$' # Regex the title should match. - allowed_prefixes: ':bookmark:' # title should start with the given prefix - prefix_case_sensitive: true # title prefix are case insensitive - min_length: 11 # Min length of the title - max_length: -1 # Max length of the title - name: Check PR title diff --git a/.zenodo.json b/.zenodo.json index 2ef5af3..7a352bb 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "git2rdata: Store and Retrieve Data.frames in a Git Repository", - "version": "0.5.1", + "version": "0.5.2", "license": "GPL-3.0", "upload_type": "software", "description": "
The git2rdata package is an R package for writing and reading dataframes as plain text files. A metadata file stores important information. 1) Storing metadata allows to maintain the classes of variables. By default, git2rdata optimizes the data for file storage. The optimization is most effective on data containing factors. The optimization makes the data less human readable. The user can turn this off when they prefer a human readable format over smaller files. Details on the implementation are available in vignette(“plain_text”, package = “git2rdata”). 2) Storing metadata also allows smaller row based diffs between two consecutive commits. This is a useful feature when storing data as plain text files under version control. Details on this part of the implementation are available in vignette(“version_control”, package = “git2rdata”). Although we envisioned git2rdata with a git workflow in mind, you can use it in combination with other version control systems like subversion or mercurial. 3) git2rdata is a useful tool in a reproducible and traceable workflow. vignette(“workflow”, package = “git2rdata”) gives a toy example. 4) vignette(“efficiency”, package = “git2rdata”) provides some insight into the efficiency of file storage, git repository size and speed for writing and reading.<\/p>", diff --git a/CITATION.cff b/CITATION.cff index 2ac49fa..e677933 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -40,4 +40,4 @@ identifiers: value: 10.5281/zenodo.1485309 - type: url value: https://ropensci.github.io/git2rdata/ -version: 0.5.1 +version: 0.5.2 diff --git a/DESCRIPTION b/DESCRIPTION index 60e5a5a..11b2fc3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: git2rdata Title: Store and Retrieve Data.frames in a Git Repository -Version: 0.5.1 +Version: 0.5.2 Authors@R: c( person("Thierry", "Onkelinx", , "thierry.onkelinx@inbo.be", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8804-4216", affiliation = "Research Institute for Nature and Forest (INBO)")), @@ -11,7 +11,7 @@ Authors@R: c( person("Els", "Lommelen", , "els.lommelen@inbo.be", role = "ctb", comment = c(ORCID = "0000-0002-3481-5684", affiliation = "Research Institute for Nature and Forest (INBO)")), person("Research Institute for Nature and Forest (INBO)", , , "info@inbo.be", role = c("cph", "fnd"), - comment = c(ROR = "https://ror.org/00j54wy13")) + comment = c(ROR = "00j54wy13")) ) Description: The git2rdata package is an R package for writing and reading dataframes as plain text files. A metadata file stores important diff --git a/NEWS.md b/NEWS.md index e9d834b..fd69dec 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# git2rdata 0.5.2 + +* Bugfix in `rename_variable()` thanks to @florisvdh for finding and fixing the + bug. + # git2rdata 0.5.1 * `write_vc()` stores metadata stored in the data frame. diff --git a/R/rename_variable.R b/R/rename_variable.R index 6466fab..acda87c 100644 --- a/R/rename_variable.R +++ b/R/rename_variable.R @@ -13,7 +13,8 @@ #' @inheritParams write_vc #' @param change A named vector with the old names as values and the new names #' as names. -#' @return invisible `NULL`. +#' @return a named vector with the file paths relative to `root`. The names +#' contain the hashes of the files. #' @export #' @examples #' @@ -106,6 +107,8 @@ rename_variable.character <- function(file, change, root = ".", ...) { yaml[["..generic"]][["data_hash"]] <- datahash(file["raw_file"]) write_yaml(yaml, file["meta_file"], fileEncoding = "UTF-8") + root <- normalizePath(root, winslash = "/", mustWork = TRUE) + file <- normalizePath(file, winslash = "/", mustWork = TRUE) hashes <- remove_root(file = file, root = root) names(hashes) <- c( diff --git a/inst/CITATION b/inst/CITATION index 2441f94..2269147 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -2,12 +2,12 @@ citHeader("To cite `git2rdata` in publications please use:") # begin checklist entry bibentry( bibtype = "Manual", - title = "git2rdata: Store and Retrieve Data.frames in a Git Repository. Version 0.5.1", + title = "git2rdata: Store and Retrieve Data.frames in a Git Repository. Version 0.5.2", author = c(person(given = "Thierry", family = "Onkelinx")), - year = 2025, + year = 2026, url = "https://ropensci.github.io/git2rdata/", abstract = "The git2rdata package is an R package for writing and reading dataframes as plain text files. A metadata file stores important information. 1) Storing metadata allows to maintain the classes of variables. By default, git2rdata optimizes the data for file storage. The optimization is most effective on data containing factors. The optimization makes the data less human readable. The user can turn this off when they prefer a human readable format over smaller files. Details on the implementation are available in vignette(\"plain_text\", package = \"git2rdata\"). 2) Storing metadata also allows smaller row based diffs between two consecutive commits. This is a useful feature when storing data as plain text files under version control. Details on this part of the implementation are available in vignette(\"version_control\", package = \"git2rdata\"). Although we envisioned git2rdata with a git workflow in mind, you can use it in combination with other version control systems like subversion or mercurial. 3) git2rdata is a useful tool in a reproducible and traceable workflow. vignette(\"workflow\", package = \"git2rdata\") gives a toy example. 4) vignette(\"efficiency\", package = \"git2rdata\") provides some insight into the efficiency of file storage, git repository size and speed for writing and reading.", - textVersion = "Onkelinx, Thierry (2025) git2rdata: Store and Retrieve Data.frames in a Git Repository. Version 0.5.1. https://ropensci.github.io/git2rdata/", + textVersion = "Onkelinx, Thierry (2026) git2rdata: Store and Retrieve Data.frames in a Git Repository. Version 0.5.2. https://ropensci.github.io/git2rdata/", keywords = "git; version control; plain text data", doi = "10.5281/zenodo.1485309", ) diff --git a/man/rename_variable.Rd b/man/rename_variable.Rd index 5876df0..6b62be1 100644 --- a/man/rename_variable.Rd +++ b/man/rename_variable.Rd @@ -35,7 +35,8 @@ writing the data. Defaults to \code{FALSE}.} \item{force}{Add ignored files. Default is FALSE.} } \value{ -invisible \code{NULL}. +a named vector with the file paths relative to \code{root}. The names +contain the hashes of the files. } \description{ The raw data file contains a header with the variable names. diff --git a/organisation.yml b/organisation.yml index 85f7264..332c08e 100644 --- a/organisation.yml +++ b/organisation.yml @@ -1,4 +1,4 @@ -checklist version: 0.5.1 +checklist version: 0.5.3 git: https://github.com/ropensci info@inbo.be: name: @@ -9,7 +9,7 @@ info@inbo.be: email: info@inbo.be website: https://www.vlaanderen.be/inbo/en-gb logo: https://inbo.github.io/checklist/reference/figures/logo-en.png - ror: https://ror.org/00j54wy13 + ror: 00j54wy13 orcid: yes zenodo: inbo rightsholder: single diff --git a/tests/testthat/test_g_rename_variable.R b/tests/testthat/test_g_rename_variable.R index 5872dd5..59fb445 100644 --- a/tests/testthat/test_g_rename_variable.R +++ b/tests/testthat/test_g_rename_variable.R @@ -227,3 +227,24 @@ test_that("rename_variable() handles wrong type of root", { "a 'root' of class numeric is not supported" ) }) + +test_that("rename_variable() shows no root in returned file names", { + root <- tempfile(pattern = "git2rdata-rename-") + dir.create(root) + filename <- "unsorted" + files <- suppressWarnings( + write_vc( + test_data, + file = filename, + split_by = "test_factor", + root = root, + strict = FALSE + ) + ) + result <- rename_variable( + file = filename, + root = root, + change = c("new_var" = "test_Date") + ) + expect_no_match(result, "git2rdata-rename-") +})