Skip to content

Commit e15f0ff

Browse files
Merge pull request #307 from lorenzwalthert/issue-255
rename to main
2 parents 467d3cf + 45c2bea commit e15f0ff

File tree

8 files changed

+21
-20
lines changed

8 files changed

+21
-20
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
on:
88
push:
99
branches:
10-
- master
1110
- main
1211
pull_request:
1312
branches:
14-
- master
1513
- main
1614

1715
name: R-CMD-check

.github/workflows/pkgdown.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
on:
22
push:
3-
branches: [main, master]
3+
branches:
4+
main
45

56
name: pkgdown
67

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ This repo uses the [tic](https://github.com/ropenscilabs/tic) package for CI.
88

99
To create a new hook, have a look at the [official
1010
documentation](https://pre-commit.com/#new-hooks) on creating new hooks, then have a look
11-
at existing hooks in this repo. The actual executables are defined in [`inst/hooks/`](https://github.com/lorenzwalthert/precommit/tree/master/inst/hooks). In
11+
at existing hooks in this repo. The actual executables are defined in [`inst/hooks/`](https://github.com/lorenzwalthert/precommit/tree/main/inst/hooks). In
1212
the script, you can expect the passed command line arguments to be all options,
1313
finally the files that should be processed with the hook.
1414

1515
For the scripts to become a hook, they need to be *registered* in
16-
[`.pre-commit-hooks.yaml`](https://github.com/lorenzwalthert/precommit/blob/master/.pre-commit-hooks.yaml). As R is not currently a supported language of
16+
[`.pre-commit-hooks.yaml`](https://github.com/lorenzwalthert/precommit/blob/main/.pre-commit-hooks.yaml). As R is not currently a supported language of
1717
pre-commit (https://github.com/pre-commit/pre-commit/issues/926), most hooks use
1818
`language: script` and then a shebang in the `entrypoint` script.
1919

2020
# Testing hooks
2121

2222
Hooks should be tested by checking both the positive outcome (hook passes) and
2323
the negative outcome (hook fails) by adding two `run_test()` statements to
24-
[`./tests/testthat/test-all.R`](https://github.com/lorenzwalthert/precommit/blob/master/tests/testthat/test-all.R). Look at existing examples and [the documentation
24+
[`./tests/testthat/test-all.R`](https://github.com/lorenzwalthert/precommit/blob/main/tests/testthat/test-all.R). Look at existing examples and [the documentation
2525
of `run_test()`](https://lorenzwalthert.github.io/precommit/reference/run_test.html). Note that this won't actually use pre-commit. It will simply
2626
call the hook script the same way as pre-commit would, with the difference that
2727
the test uses a path to the `Rscript` executable whereas with pre-commit, the

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ includes switching to R based hook for `readme-rmd-render`, avoiding the
66
used packages, roxygen snippet generation and more. In addition:
77

88
* Always sort `inst/WORDLIST` (#303).
9+
* rename default branch to *main* (#307).
10+
911

1012
# precommit v0.1.3.9012
1113

R/config.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,5 @@ set_config_source <- function(config_source,
126126

127127

128128
example_remote_config <- function() {
129-
"https://raw.githubusercontent.com/lorenzwalthert/precommit/master/inst/pre-commit-config-proj.yaml"
129+
"https://raw.githubusercontent.com/lorenzwalthert/precommit/main/inst/pre-commit-config-proj.yaml"
130130
}

R/release.R

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#'
1919
#' @section CRAN release:
2020
#' If `is_cran` is `TRUE`, the workflow is changed slightly:
21-
#' - push to release branch, not master.
21+
#' - push to release branch, not main.
2222
#' - doesn't run [release_complete()]. This must be done manually after accepted
2323
#' on CRAN.
2424
#' @keywords internal
@@ -27,7 +27,7 @@ release_gh <- function(bump = "dev", is_cran = bump != "dev") {
2727
new_dsc$write()
2828
git_branch_set(is_cran)
2929
if (!is_cran) {
30-
on.exit(sys_call("git", c("checkout", "master")), add = TRUE)
30+
on.exit(sys_call("git", c("checkout", "main")), add = TRUE)
3131
}
3232

3333
# if we fail, must reset version, if we succeed, it's not stage
@@ -78,12 +78,12 @@ release_gh <- function(bump = "dev", is_cran = bump != "dev") {
7878
#' @param tag The tag to push. `NULL` will derive the tag from `DESCRIPTION`.
7979
#' @keywords internal
8080
release_complete <- function(ask = TRUE, is_cran = ask, tag = NULL) {
81-
if (git_branch_get() != "master") {
82-
rlang::abort("Must be on master to complete the release.")
81+
if (git_branch_get() != "main") {
82+
rlang::abort("Must be on main to complete the release.")
8383
}
8484
if (ask) {
85-
abort_if_not_yes("Did you merge the release branch into master?")
86-
abort_if_not_yes("Did you pull the latest master from origin?")
85+
abort_if_not_yes("Did you merge the release branch into main?")
86+
abort_if_not_yes("Did you pull the latest main from origin?")
8787
}
8888
if (is_cran) {
8989
if (is.null(tag)) {
@@ -94,7 +94,7 @@ release_complete <- function(ask = TRUE, is_cran = ask, tag = NULL) {
9494
}
9595
sys_call("git", glue::glue("push origin {tag}"))
9696
}
97-
precommit::autoupdate() # only updates if tag is on the master branch
97+
precommit::autoupdate() # only updates if tag is on the main branch
9898
desc::desc_bump_version("dev")
9999
cli::cli_alert_success("Bumped version to dev")
100100
sys_call("git", glue::glue('commit DESCRIPTION .pre-commit-config.yaml -m "use latest release"'),
@@ -184,9 +184,9 @@ git_branch_set <- function(is_cran) {
184184
)
185185
cli::cli_alert_success("Checked out branch {branch_name} for CRAN release process.")
186186
} else {
187-
if (git_branch_get() != "master") {
187+
if (git_branch_get() != "main") {
188188
rlang::abort(paste(
189-
"Need to be on branch 'master' to create a release, otherwise autoudate",
189+
"Need to be on branch 'main' to create a release, otherwise autoudate",
190190
"won't use the new ref."
191191
))
192192
}
@@ -196,9 +196,9 @@ git_branch_set <- function(is_cran) {
196196

197197
git_assert_even_with_origin <- function() {
198198
tmp <- tempfile()
199-
system2("git", "diff HEAD..origin/master", stdout = tmp)
199+
system2("git", "diff HEAD..origin/main", stdout = tmp)
200200
if (length(readLines(tmp) > 0)) {
201-
rlang::abort("remote master must be even with local master before release process can start.")
201+
rlang::abort("remote main must be even with local main before release process can start.")
202202
}
203203
}
204204

man/release_gh.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/FAQ.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ described [here](https://pre-commit.com/#temporarily-disabling-hooks).
9191

9292
## How does one create a new pre-commit hook?
9393

94-
How to contribute new hooks is explained in [`CONTRIBUTING.md`](https://github.com/lorenzwalthert/precommit/blob/master/CONTRIBUTING.md).
94+
How to contribute new hooks is explained in [`CONTRIBUTING.md`](https://github.com/lorenzwalthert/precommit/blob/main/CONTRIBUTING.md).
9595

9696
***
9797

0 commit comments

Comments
 (0)