Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tweak message to make it shorter.
  • Loading branch information
olivroy committed Jun 9, 2024
commit 70e17a247955f4cb7252833fd818a239baf5a8cd
25 changes: 16 additions & 9 deletions R/utils-git.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,22 @@ challenge_uncommitted_changes <- function(
rstudioapi::documentSaveAll()
}

default_msg <- "
There are uncommitted changes, which may cause problems or be lost when \\
we {.or {which}}"
msg <- glue(msg %||% default_msg)
if (git_uncommitted(untracked = untracked)) {
if (ui_yep(c(
"!" = msg,
" " = "Do you want to proceed anyway?"
))) {
default_msg <-
"Uncommitted changes may cause problems or be lost when we {.or {which}}."
msg <- cli::format_inline(msg %||% default_msg)

uncommited <- git_status(untracked)
if (nrow(uncommited) > 0) {
choice <- utils::menu(
c(
"I want to proceed anyway.",
cli::format_inline(
"I want to take a closer look at {.file {uncommited$file}} first."
)
),
title = msg
)
if (choice == 1) {
return(invisible())
} else {
ui_abort("Uncommitted changes. Please commit before continuing.", call = NULL)
Expand Down