Skip to content

Commit

Permalink
Empty repo check
Browse files Browse the repository at this point in the history
  • Loading branch information
rundel committed Aug 22, 2024
1 parent 637e797 commit 4737634
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ghclass
Title: Tools for Managing Classes on GitHub
Version: 0.3.0
Version: 0.3.0.9000
Authors@R:
c(person(given = "Colin",
family = "Rundel",
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ghclass (development version)

* Added check to `repo_mirror_template()` for empty repositories to avoid cryptic GitHub api error.

# ghclass 0.3.0

* Added support for basig GitHub Pages API endpoints - see `pages_enabled()`, `pages_status()`, `pages_create()`, and `pages_delete()`.
Expand Down
4 changes: 4 additions & 0 deletions R/repo_mirror_template.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ repo_mirror_template = function(source_repo, target_repo, private = TRUE) {
arg_is_chr(target_repo)
arg_is_lgl_scalar(private)

if (length(repo_ls(source_repo)) == 0) {
cli_stop("Cannot mirror {.val {source_repo}} because the repository is empty.")
}

target_repo = unique(target_repo)
exists = repo_exists(target_repo)

Expand Down

0 comments on commit 4737634

Please sign in to comment.