diff --git a/NEWS.md b/NEWS.md index 5ef77276c..a8444a635 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # usethis (development version) +* `use_git()` no longer asks if you want to restart RStudio when using Positron. + * `use_test()` and `use_r()` now work when you are in `tests/testthat/_snaps/{foo}.md` (@olivroy, #1988). * The URLs baked into the badge generated by `use_coverage(type = "codecov")` diff --git a/R/git.R b/R/git.R index 6596a6449..d4be332e0 100644 --- a/R/git.R +++ b/R/git.R @@ -22,7 +22,7 @@ use_git <- function(message = "Initial commit") { git_ask_commit(message, untracked = TRUE) } - if (needs_init) { + if (needs_init && !is_positron()) { restart_rstudio("A restart of RStudio is required to activate the Git pane.") } diff --git a/R/positron.R b/R/positron.R new file mode 100644 index 000000000..7bf221fd1 --- /dev/null +++ b/R/positron.R @@ -0,0 +1,3 @@ +is_positron <- function() { + Sys.getenv("POSITRON") == "1" +}