Skip to content

Commit

Permalink
Tweaks from playing with this locally
Browse files Browse the repository at this point in the history
  • Loading branch information
jennybc committed Jul 23, 2024
1 parent 0dd961a commit af2e5c7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions R/github.R
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,13 @@ check_no_github_repo <- function(owner, repo, host) {
spec <- glue("{owner}/{repo}")
repo_found <- tryCatch(
{
repo_info <- gh::gh(
"/repos/{owner}/{repo}",
owner = owner, repo = repo,
.api_url = host
)
# FALSE if there is a redirect due to renamed repo
# so we should be able to push, otherwise
# TRUE if it really exists. #1893
repo_info <- gh::gh("/repos/{spec}", spec = spec, .api_url = host)
# when does repo_info$full_name != the spec we sent?
# this happens if you reuse the original name of a repo that has since
# been renamed
# there's no 404, because of the automatic redirect, but you CAN create
# a new repo with this name
# https://github.com/r-lib/usethis/issues/1893
repo_info$full_name == spec
},
"http_error_404" = function(err) FALSE
Expand Down

0 comments on commit af2e5c7

Please sign in to comment.