r-lib / gert

Simple git client for R
https://docs.ropensci.org/gert/
Other
148 stars 32 forks source link

`git_ls()` returns incorrect filesize, modified time and created time when run with a ref #211

Closed r-ash closed 8 months ago

r-ash commented 8 months ago

When I run git_ls with any explicit ref it returns with 0 for filesize, modified time and created time

Tested this with gert v 2.0.1. To recreate

t <- tempfile()
dir.create(t)
writeLines(c("# Example", "", "example repo"), file.path(t, "README.md"))
gert::git_init(t)
gert::git_add(".", repo = t)
user <- "author <author@example.com>"
sha <- gert::git_commit("initial", author = user, committer = user, repo = t)
without_ref <- gert::git_ls(repo = t)
with_ref <- gert::git_ls(repo = t, ref = "HEAD")
>   without_ref
# A tibble: 1 × 4
  path      filesize modified            created            
* <chr>        <dbl> <dttm>              <dttm>             
1 README.md       24 2024-02-23 17:13:30 2024-02-23 17:13:30
>   with_ref
# A tibble: 1 × 4
  path      filesize modified            created            
* <chr>        <dbl> <dttm>              <dttm>             
1 README.md        0 1970-01-01 01:00:00 1970-01-01 01:00:00
r-ash commented 8 months ago

Fixed! Thanks for speedy work :pray: