Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jennybc committed Jul 24, 2024
1 parent 0ecac12 commit 27e343d
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions R/utils-git.R
Original file line number Diff line number Diff line change
Expand Up @@ -225,30 +225,27 @@ git_conflict_report <- function() {
))

msg <- "Are you ready to sort this out?"
yes <- "Yes, open the files. I'm ready to resolve the merge conflicts."
yes_soft <- "Yes, but don't open the files. I will resolve the merge conflicts."
yes <- "Yes, open the conflicted files for editing."
yes_soft <- "Yes, but do not open the conflicted files."

Check warning on line 229 in R/utils-git.R

View check run for this annotation

Codecov / codecov/patch

R/utils-git.R#L227-L229

Added lines #L227 - L229 were not covered by tests
no <- "No, I want to abort this merge."
merge_strategy <- utils::menu(
choice <- utils::menu(
choices = c(yes, yes_soft, no),
title = msg
)

Check warning on line 234 in R/utils-git.R

View check run for this annotation

Codecov / codecov/patch

R/utils-git.R#L231-L234

Added lines #L231 - L234 were not covered by tests
if (merge_strategy == 1) {
ui_silence(purrr::walk(conflicted, edit_file))
ui_abort(c(
"Please fix each conflict, save, stage, and commit.",
"To back out of this merge, run {.code gert::git_merge_abort()}
(in R) or {.code git merge --abort} (in the shell)."
))
} else if (merge_strategy == 2) {
ui_abort(c(
"Please fix each conflict, save, stage, and commit.",
"To back out of this merge, run {.code gert::git_merge_abort()}
(in R) or {.code git merge --abort} (in the shell)."
))
} else {

if (choice < 1 || choice > 2) {

Check warning on line 236 in R/utils-git.R

View check run for this annotation

Codecov / codecov/patch

R/utils-git.R#L236

Added line #L236 was not covered by tests
gert::git_merge_abort(repo = git_repo())
ui_abort("Abandoning the merge, since it will cause merge conflicts.")
}

if (choice == 1) {
ui_silence(purrr::walk(conflicted, edit_file))

Check warning on line 242 in R/utils-git.R

View check run for this annotation

Codecov / codecov/patch

R/utils-git.R#L241-L242

Added lines #L241 - L242 were not covered by tests
}
ui_abort(c(
"Please fix each conflict, save, stage, and commit.",
"To back out of this merge, run {.code gert::git_merge_abort()}
(in R) or {.code git merge --abort} (in the shell)."
))

Check warning on line 248 in R/utils-git.R

View check run for this annotation

Codecov / codecov/patch

R/utils-git.R#L244-L248

Added lines #L244 - L248 were not covered by tests
}

# Remotes ----------------------------------------------------------------------
Expand Down

0 comments on commit 27e343d

Please sign in to comment.