remotes icon indicating copy to clipboard operation
remotes copied to clipboard

SSH External Git Install with *short* SHA Ref fail

Open muschellij2 opened this issue 4 years ago • 4 comments

SSH Installs Fine (Just for checking)

This works fine and if the ref is a tag, then it seems to work fine

remotes::install_git("[email protected]:tidyverse/stringr.git", git = "external")
#> Downloading git repo [email protected]:tidyverse/stringr.git
#> '/usr/bin/git' clone --depth 1 --no-hardlinks [email protected]:tidyverse/stringr.git /tmp/RtmpmTPyz6/file59801318d231
#> 
#>      checking for file ‘/tmp/RtmpmTPyz6/file59801318d231/DESCRIPTION’ ...  ✓  checking for file ‘/tmp/RtmpmTPyz6/file59801318d231/DESCRIPTION’ (345ms)
#>   ─  preparing ‘stringr’:
#>      checking DESCRIPTION meta-information ...  ✓  checking DESCRIPTION meta-information
#>   ─  checking for LF line-endings in source and make files and shell scripts
#>   ─  checking for empty or unneeded directories
#>   ─  building ‘stringr_1.4.0.9000.tar.gz’
#>      
#> 
#> Installing package into '/home/jupyter/.R/library'
#> (as 'lib' is unspecified)
remotes::install_git("[email protected]:tidyverse/stringr.git", 
                     ref = "stringr-0.2", git = "external")
#> Downloading git repo [email protected]:tidyverse/stringr.git
#> '/usr/bin/git' clone --depth 1 --no-hardlinks [email protected]:tidyverse/stringr.git /tmp/RtmpmTPyz6/file598033d5f100
#> '/usr/bin/git' fetch origin stringr-0.2
#> '/usr/bin/git' checkout FETCH_HEAD
#> 
#>      checking for file ‘/tmp/RtmpmTPyz6/file598033d5f100/DESCRIPTION’ ...  ✓  checking for file ‘/tmp/RtmpmTPyz6/file598033d5f100/DESCRIPTION’
#>   ─  preparing ‘stringr’:
#>      checking DESCRIPTION meta-information ...  ✓  checking DESCRIPTION meta-information
#>   ─  checking for LF line-endings in source and make files and shell scripts
#>   ─  checking for empty or unneeded directories
#>   ─  creating default NAMESPACE file
#> ─  building ‘stringr_0.2.tar.gz’
#>      
#> 
#> Installing package into '/home/jupyter/.R/library'
#> (as 'lib' is unspecified)

SHA

Using an SHA - fails. I believe this is due to depth, but unsure, still working it out. Can confirm https://github.com/tidyverse/stringr/commit/dd909b7 exists.

remotes::install_git("[email protected]:tidyverse/stringr.git@dd909b7", git = "external")
#> Downloading git repo [email protected]:tidyverse/stringr.git
#> '/usr/bin/git' clone --depth 1 --no-hardlinks [email protected]:tidyverse/stringr.git /tmp/RtmpmTPyz6/file5980644511a7
#> '/usr/bin/git' fetch origin dd909b7
#> Warning in system(full, intern = TRUE, ignore.stderr = quiet): running command
#> ''/usr/bin/git' fetch origin dd909b7' had status 128
#> Error : Command failed (128)
remotes::install_git("[email protected]:tidyverse/stringr.git", ref = "dd909b7", git = "external")
#> Downloading git repo [email protected]:tidyverse/stringr.git
#> '/usr/bin/git' clone --depth 1 --no-hardlinks [email protected]:tidyverse/stringr.git /tmp/RtmpmTPyz6/file59801d9d0be2
#> '/usr/bin/git' fetch origin dd909b7
#> Warning in system(full, intern = TRUE, ignore.stderr = quiet): running command
#> ''/usr/bin/git' fetch origin dd909b7' had status 128
#> Error : Command failed (128)
/usr/bin/git --version
git version 2.20.1

Created on 2021-12-02 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> ─ Session info  ──────────────────────────────────────────────────────────────
#>  hash: carousel horse, waving hand: medium-dark skin tone, transgender symbol
#> 
#>  setting  value
#>  version  R version 4.1.2 (2021-11-01)
#>  os       Debian GNU/Linux 10 (buster)
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  C.UTF-8
#>  ctype    C.UTF-8
#>  tz       Etc/UTC
#>  date     2021-12-02
#>  pandoc   2.14.0.2 @ /opt/conda/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  ! package     * version    date (UTC) lib source
#>    callr         3.7.0      2021-04-20 [2] CRAN (R 4.1.0)
#>    cli           3.1.0.9000 2021-10-29 [1] Github (r-lib/cli@1af3d91)
#>    crayon        1.4.2      2021-10-29 [1] CRAN (R 4.1.0)
#>    curl          4.3.2      2021-06-23 [1] CRAN (R 4.1.0)
#>    digest        0.6.28     2021-09-23 [1] CRAN (R 4.1.0)
#>    evaluate      0.14       2019-05-28 [2] CRAN (R 4.1.0)
#>    fastmap       1.1.0      2021-01-25 [2] CRAN (R 4.1.0)
#>    fs            1.5.1      2021-11-30 [1] CRAN (R 4.1.0)
#>    glue          1.5.1      2021-11-30 [1] CRAN (R 4.1.0)
#>    highr         0.9        2021-04-16 [2] CRAN (R 4.1.0)
#>    htmltools     0.5.2      2021-08-25 [1] CRAN (R 4.1.0)
#>    knitr         1.36       2021-09-29 [1] CRAN (R 4.1.0)
#>    magrittr      2.0.1      2020-11-17 [2] CRAN (R 4.1.0)
#>    pkgbuild      1.2.1      2021-11-30 [1] CRAN (R 4.1.0)
#>    prettyunits   1.1.1      2020-01-24 [2] CRAN (R 4.1.0)
#>    processx      3.5.2      2021-04-30 [2] CRAN (R 4.1.0)
#>    ps            1.6.0      2021-02-28 [2] CRAN (R 4.1.0)
#>    R6            2.5.1      2021-08-19 [1] CRAN (R 4.1.0)
#>    remotes       2.4.2      2021-12-02 [1] Github (r-lib/remotes@fcad17b)
#>    reprex        2.0.1      2021-08-05 [1] CRAN (R 4.1.0)
#>    rlang         0.4.12     2021-10-18 [1] CRAN (R 4.1.0)
#>    rmarkdown     2.11       2021-09-14 [1] CRAN (R 4.1.0)
#>    rprojroot     2.0.2      2020-11-15 [2] CRAN (R 4.1.0)
#>    rstudioapi    0.13       2020-11-12 [2] CRAN (R 4.1.0)
#>    sessioninfo   1.1.1.9000 2021-11-30 [1] Github (muschellij2/sessioninfo@6e2857d)
#>    stringi       1.7.6      2021-11-29 [1] CRAN (R 4.1.0)
#>  V stringr       1.4.0      2021-12-02 [1] xgit ([email protected]:tidyverse/stringr.git@d32c3d9) (on disk 0.2)
#>    withr         2.4.3      2021-11-30 [1] CRAN (R 4.1.0)
#>    xfun          0.28       2021-11-04 [1] CRAN (R 4.1.0)
#>    yaml          2.2.1      2020-02-01 [2] CRAN (R 4.1.0)
#> 
#>  [1] /home/jupyter/.R/library
#>  [2] /usr/local/lib/R/site-library
#>  [3] /usr/lib/R/site-library
#>  [4] /usr/lib/R/library
#> 
#>  V ── Loaded and on-disk version mismatch.
#> 
#> ──────────────────────────────────────────────────────────────────────────────

muschellij2 avatar Dec 02 '21 20:12 muschellij2

Using the full SHA works, though:

remotes::install_git(
  "[email protected]:tidyverse/stringr.git@dd909b714b20ff3add2eedb0a1c917ba6938e40e",
  git = "external"
)

Isn't this good enough?

gaborcsardi avatar Dec 02 '21 21:12 gaborcsardi

remotes::install_git("[email protected]:tidyverse/stringr.git@dd909b7", git = "external")
#> Downloading git repo [email protected]:tidyverse/stringr.git
#> '/usr/bin/git' clone --depth 1 --no-hardlinks [email protected]:tidyverse/stringr.git /tmp/RtmpKlz895/file743a4ed8c6e6
#> '/usr/bin/git' fetch origin dd909b7
#> Warning in system(full, intern = TRUE, ignore.stderr = quiet): running command
#> ''/usr/bin/git' fetch origin dd909b7' had status 128
#> Error : Command failed (128)
remotes::install_git("[email protected]:tidyverse/stringr.git@dd909b714b20ff3add2eedb0a1c917ba6938e40e", git = "external")
#> Downloading git repo [email protected]:tidyverse/stringr.git
#> '/usr/bin/git' clone --depth 1 --no-hardlinks [email protected]:tidyverse/stringr.git /tmp/RtmpKlz895/file743a1c306a17
#> '/usr/bin/git' fetch origin dd909b714b20ff3add2eedb0a1c917ba6938e40e
#> '/usr/bin/git' checkout FETCH_HEAD
#> 
#>      checking for file ‘/tmp/RtmpKlz895/file743a1c306a17/DESCRIPTION’ ...  ✓  checking for file ‘/tmp/RtmpKlz895/file743a1c306a17/DESCRIPTION’
#>   ─  preparing ‘stringr’:
#>      checking DESCRIPTION meta-information ...  ✓  checking DESCRIPTION meta-information
#>   ─  checking for LF line-endings in source and make files and shell scripts
#>   ─  checking for empty or unneeded directories
#>   ─  building ‘stringr_1.4.0.9000.tar.gz’
#>      
#> 
#> Installing package into '/home/jupyter/.R/library'
#> (as 'lib' is unspecified)

Created on 2021-12-02 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> ─ Session info  ──────────────────────────────────────────────────────────────
#>  hash: woman: medium-light skin tone, red hair, vampire: dark skin tone, exploding head
#> 
#>  setting  value
#>  version  R version 4.1.2 (2021-11-01)
#>  os       Debian GNU/Linux 10 (buster)
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  C.UTF-8
#>  ctype    C.UTF-8
#>  tz       Etc/UTC
#>  date     2021-12-02
#>  pandoc   2.14.0.2 @ /opt/conda/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  callr         3.7.0      2021-04-20 [2] CRAN (R 4.1.0)
#>  cli           3.1.0.9000 2021-10-29 [1] Github (r-lib/cli@1af3d91)
#>  crayon        1.4.2      2021-10-29 [1] CRAN (R 4.1.0)
#>  curl          4.3.2      2021-06-23 [1] CRAN (R 4.1.0)
#>  digest        0.6.28     2021-09-23 [1] CRAN (R 4.1.0)
#>  evaluate      0.14       2019-05-28 [2] CRAN (R 4.1.0)
#>  fastmap       1.1.0      2021-01-25 [2] CRAN (R 4.1.0)
#>  fs            1.5.1      2021-11-30 [1] CRAN (R 4.1.0)
#>  glue          1.5.1      2021-11-30 [1] CRAN (R 4.1.0)
#>  highr         0.9        2021-04-16 [2] CRAN (R 4.1.0)
#>  htmltools     0.5.2      2021-08-25 [1] CRAN (R 4.1.0)
#>  knitr         1.36       2021-09-29 [1] CRAN (R 4.1.0)
#>  lifecycle     1.0.1      2021-09-24 [1] CRAN (R 4.1.0)
#>  magrittr      2.0.1      2020-11-17 [2] CRAN (R 4.1.0)
#>  pkgbuild      1.2.1      2021-11-30 [1] CRAN (R 4.1.0)
#>  prettyunits   1.1.1      2020-01-24 [2] CRAN (R 4.1.0)
#>  processx      3.5.2      2021-04-30 [2] CRAN (R 4.1.0)
#>  ps            1.6.0      2021-02-28 [2] CRAN (R 4.1.0)
#>  R6            2.5.1      2021-08-19 [1] CRAN (R 4.1.0)
#>  remotes       2.4.2      2021-12-02 [1] Github (r-lib/remotes@fcad17b)
#>  reprex        2.0.1      2021-08-05 [1] CRAN (R 4.1.0)
#>  rlang         0.4.12     2021-10-18 [1] CRAN (R 4.1.0)
#>  rmarkdown     2.11       2021-09-14 [1] CRAN (R 4.1.0)
#>  rprojroot     2.0.2      2020-11-15 [2] CRAN (R 4.1.0)
#>  rstudioapi    0.13       2020-11-12 [2] CRAN (R 4.1.0)
#>  sessioninfo   1.1.1.9000 2021-11-30 [1] Github (muschellij2/sessioninfo@6e2857d)
#>  stringi       1.7.6      2021-11-29 [1] CRAN (R 4.1.0)
#>  stringr       1.4.0.9000 2021-12-02 [1] xgit ([email protected]:tidyverse/stringr.git@dd909b7)
#>  vctrs         0.3.8      2021-04-29 [2] CRAN (R 4.1.0)
#>  withr         2.4.3      2021-11-30 [1] CRAN (R 4.1.0)
#>  xfun          0.28       2021-11-04 [1] CRAN (R 4.1.0)
#>  yaml          2.2.1      2020-02-01 [2] CRAN (R 4.1.0)
#> 
#>  [1] /home/jupyter/.R/library
#>  [2] /usr/local/lib/R/site-library
#>  [3] /usr/lib/R/site-library
#>  [4] /usr/lib/R/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

muschellij2 avatar Dec 02 '21 21:12 muschellij2

Yeah I just saw that. I am using sessioninfo::package_info to get deps, so I guess I gotta get the full one. OK - good to close and kill the PR (maybe a warning with short SHAs?)

muschellij2 avatar Dec 02 '21 21:12 muschellij2

I like the idea of warning for short SHAs for (x)git remotes.

It would be great to make the short SHAs work, but deep cloning can also be really bad for bug repos.

I'll reopen this for adding the warning.

gaborcsardi avatar Dec 02 '21 21:12 gaborcsardi