ropensci / git2r

R bindings to the libgit2 library
https://docs.ropensci.org/git2r
GNU General Public License v2.0
215 stars 58 forks source link

workdir returns NULL after initializing #437

Closed campbead closed 2 years ago

campbead commented 2 years ago

After initializing a repository using init command, the workdirfunction returns NULL

Here is my minimal example using examples from the introductory materials:

library(git2r)
path <- tempfile(pattern="git2r-", tmpdir = "C:\\Working")
dir.create(path)
repo <- init(path, bare=TRUE)
workdir(repo)

Help here would be great. Happy to provide any addition info.

for context my session_info:

> devtools::session_info()
- Session info ------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_New Zealand.1252    
 ctype    English_New Zealand.1252    
 tz       Pacific/Auckland            
 date     2021-12-10                  

- Packages ----------------------------------------------------------------------------------------------------------
 package     * version date       lib source        
 cachem        1.0.4   2021-02-13 [1] CRAN (R 3.6.3)
 callr         3.7.0   2021-04-20 [1] CRAN (R 3.6.3)
 cli           2.5.0   2021-04-26 [1] CRAN (R 3.6.3)
 crayon        1.4.2   2021-10-29 [1] CRAN (R 3.6.1)
 desc          1.3.0   2021-03-05 [1] CRAN (R 3.6.3)
 devtools      2.4.2   2021-06-07 [1] CRAN (R 3.6.1)
 digest        0.6.27  2020-10-24 [1] CRAN (R 3.6.3)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 3.6.3)
 evaluate      0.14    2019-05-28 [1] CRAN (R 3.6.3)
 fansi         0.4.2   2021-01-15 [1] CRAN (R 3.6.3)
 fastmap       1.1.0   2021-01-25 [1] CRAN (R 3.6.3)
 fs            1.5.0   2020-07-31 [1] CRAN (R 3.6.3)
 git2r       * 0.29.0  2021-11-22 [1] CRAN (R 3.6.1)
 glue          1.4.2   2020-08-27 [1] CRAN (R 3.6.3)
 hms           1.1.1   2021-09-26 [1] CRAN (R 3.6.1)
 htmltools     0.5.1.1 2021-01-22 [1] CRAN (R 3.6.3)
 knitr         1.33    2021-04-24 [1] CRAN (R 3.6.3)
 lifecycle     1.0.1   2021-09-24 [1] CRAN (R 3.6.1)
 magrittr      2.0.1   2020-11-17 [1] CRAN (R 3.6.3)
 memoise       2.0.0   2021-01-26 [1] CRAN (R 3.6.3)
 paws          0.1.12  2021-09-03 [1] CRAN (R 3.6.1)
 pillar        1.6.4   2021-10-18 [1] CRAN (R 3.6.1)
 pkgbuild      1.2.0   2020-12-15 [1] CRAN (R 3.6.3)
 pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 3.6.3)
 pkgload       1.2.1   2021-04-06 [1] CRAN (R 3.6.3)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 3.6.3)
 processx      3.5.2   2021-04-30 [1] CRAN (R 3.6.3)
 ps            1.6.0   2021-02-28 [1] CRAN (R 3.6.3)
 purrr         0.3.4   2020-04-17 [1] CRAN (R 3.6.3)
 R6            2.5.1   2021-08-19 [1] CRAN (R 3.6.1)
 readr         1.4.0   2020-10-05 [1] CRAN (R 3.6.3)
 remotes       2.4.1   2021-09-29 [1] CRAN (R 3.6.1)
 rlang         0.4.11  2021-04-30 [1] CRAN (R 3.6.3)
 rmarkdown     2.8     2021-05-07 [1] CRAN (R 3.6.3)
 rprojroot     2.0.2   2020-11-15 [1] CRAN (R 3.6.3)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.3)
 testthat      3.0.2   2021-02-14 [1] CRAN (R 3.6.3)
 tibble        3.1.1   2021-04-18 [1] CRAN (R 3.6.3)
 usethis       2.0.1   2021-02-10 [1] CRAN (R 3.6.3)
 utf8          1.2.1   2021-03-12 [1] CRAN (R 3.6.3)
 vctrs         0.3.8   2021-04-29 [1] CRAN (R 3.6.3)
 withr         2.4.2   2021-04-18 [1] CRAN (R 3.6.1)
 xfun          0.22    2021-03-11 [1] CRAN (R 3.6.3)
 yaml          2.2.1   2020-02-01 [1] CRAN (R 3.6.3)

[1] C:/RStudio
[2] C:/Program Files/R/R-3.6.1/library
campbead commented 2 years ago

I figured this out. The bare = TRUE argument prevents a workdir from being created