From 3d4f0e6f732d8dfe2824cd315076b6320be7a54f Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Fri, 28 Jun 2024 07:57:32 -0500 Subject: [PATCH] Positron doesn't need restart for git pane --- NEWS.md | 2 ++ R/git.R | 2 +- R/positron.R | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 R/positron.R diff --git a/NEWS.md b/NEWS.md index 550ba4a90..ebbc59a8d 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. + * The URLs baked into the badge generated by `use_coverage(type = "codecov")` no longer specify a branch (#2008). 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" +}