Description
I cleared out my R/RStudio/Git setup to try to see what new users see, to help R4DS users get up to speed. I accidentally skipped the usethis::use_git_config(user.name = "Jane Doe", user.email = "jane@example.org")
step, and was somewhat surprised to find that git_sitrep()
failed rather than telling me about it. It's POSSIBLE this happened due to something being half-set somewhere (it's surprisingly hard to clear out every setting for everything everywhere), but I'm PRETTY sure this could be common.
This causes an error in pat_sitrep()
in the emails section, because de_facto_email
is NULL.
Maybe add something toward the beginning of git_sitrep()
to error with a message telling the user to run use_git_config()
?
dat <- gert::git_config_global()
if ("user.email" %in% dat$name) {
old_email <- dat[dat$name == "user.email",]$value
usethis::use_git_config(user.email = NULL)
}
usethis::git_sitrep()
#> Git config (global)
#> • Name: 'Jon Harmon'
#> • Email: <unset>
#> • Global (user-level) gitignore file: 'C:/Users/jonth/.gitignore'
#> • Vaccinated: TRUE
#> ℹ Defaulting to 'https' Git protocol
#> • Default Git protocol: 'https'
#> • Default initial branch name: 'main'
#> GitHub
#> • Default GitHub host: 'https://github.com'
#> • Personal access token for 'https://github.com': '<discovered>'
#> • GitHub user: 'jonthegeek'
#> • Token scopes: 'gist, repo, user, workflow'
#> • Email(s): 'jonthegeek@gmail.com (primary)', '33983824+jonthegeek@users.noreply.github.com', 'jonthegeek42@gmail.com'
#> Error in grepl(de_facto_email, addresses): invalid 'pattern' argument
if ("user.email" %in% dat$name) {
usethis::use_git_config(user.email = old_email)
}
Created on 2022-11-30 with reprex v2.0.2