Skip to content

Commit 2335ef3

Browse files
authored
Merge pull request #16 from stewid/fake-repo-branch-name
Specify branch name for the fake repo
2 parents edf5ba7 + 2deda54 commit 2335ef3

File tree

14 files changed

+55
-49
lines changed

14 files changed

+55
-49
lines changed

R/fake_repo.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,7 @@ fake_repo <- function(path = tempfile(pattern = "git2r-"), as.package = FALSE) {
9393
dir.create(file.path(path, "vignettes"))
9494
}
9595

96+
git2r::checkout(repo, branch = "main", create = TRUE)
97+
9698
return(path)
9799
}

R/get_commits.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
#' @examples
2626
#' repo <- fake_repo()
2727
#' get_commits_tags(repo = repo)
28-
get_commits_tags <- function(repo = ".", ref = "master",
28+
get_commits_tags <- function(repo = ".", ref = "main",
2929
path = NULL, silent = FALSE) {
30-
# checkout(repo, "master")
30+
# checkout(repo, "main")
3131
# Get commits
3232
all_commits <- commits(
3333
repo = repo, ref = ref,
@@ -108,7 +108,7 @@ get_commits_tags <- function(repo = ".", ref = "master",
108108

109109
get_commits_pattern <- function(repo = ".", pattern = c("Ticket" = "#[[:digit:]]+"),
110110
pattern.table = NULL,
111-
ref = "master", path = NULL, silent = FALSE) {
111+
ref = "main", path = NULL, silent = FALSE) {
112112

113113
if (is.null(names(pattern))) {names(pattern) <- paste0("`", pattern, "`")}
114114

R/git_down.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#' @param book_path The path to the bookdown output. Default is `"gitdown"`.
1010
#' @param open Should the bookdown be opened once compiled? Default is TRUE.
1111
#' @param author Author of the bookdown
12-
#' @param ref the name of the branch, by default master
12+
#' @param ref the name of the branch, by default main
1313
#' @param ... Other parameters to pass to [rmarkdown::render()]
1414
#'
1515
#' @inheritParams get_commits_pattern
@@ -51,7 +51,7 @@ git_down <- function(repo = ".", book_path = "gitdown",
5151
open = TRUE, author = "John Doe",
5252
pattern = c("Issues" = "#[[:digit:]]+"),
5353
pattern.table = NULL,
54-
ref = "master", ...) {
54+
ref = "main", ...) {
5555

5656
# Clean previous book
5757
unlink(file.path(repo, book_path), recursive = TRUE)

R/utils.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ to_singular <- function(x) {
134134
nest_commits_by_pattern <- function(repo,
135135
pattern = c("Issues" = "#[[:digit:]]+"),
136136
pattern.table = NULL,
137-
ref = "master", silent = TRUE) {
137+
ref = "main", silent = TRUE) {
138138

139139
res <- get_commits_pattern(repo, pattern = pattern,
140140
pattern.table = pattern.table,
@@ -211,7 +211,7 @@ nest_commits_by_pattern <- function(repo,
211211
#' res_commits <- nest_commits_by_pattern(
212212
#' repo,
213213
#' pattern = c("Tickets" = "ticket[[:digit:]]+"),
214-
#' ref = "master", silent = TRUE
214+
#' ref = "main", silent = TRUE
215215
#' )
216216
#' each_pattern(res_commits, "Tickets")
217217

README.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ file.copy(list.files("reference/figures", full.names = TRUE),
2525

2626
<!-- badges: start -->
2727
[![R-CMD-check](https://github.com/ThinkR-open/gitdown/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/gitdown/actions)
28-
[![Coverage status](https://codecov.io/gh/ThinkR-open/gitdown/branch/master/graph/badge.svg)](https://codecov.io/github/ThinkR-open/gitdown?branch=master)
28+
[![Coverage status](https://codecov.io/gh/ThinkR-open/gitdown/branch/main/graph/badge.svg)](https://codecov.io/github/ThinkR-open/gitdown?branch=main)
2929
[![CRAN status](https://www.r-pkg.org/badges/version/gitdown)](https://CRAN.R-project.org/package=gitdown)
3030
<!-- badges: end -->
3131

@@ -106,7 +106,7 @@ As a side effect of {gitdown}, you can get some intermediate information used to
106106
Get commits with issues mentioned. The searched pattern is a `#` followed by at least one number: `"#[[:digit:]]+"`. Variable `pattern.content` lists patterns found in the commit messages.
107107

108108
```{r}
109-
get_commits_pattern(repo, pattern = "#[[:digit:]]+", ref = "master") %>%
109+
get_commits_pattern(repo, pattern = "#[[:digit:]]+", ref = "main") %>%
110110
select(pattern.content, everything())
111111
```
112112

@@ -116,7 +116,7 @@ Get commits with issues and specific home-made pattern. Use a named vector to pr
116116
get_commits_pattern(
117117
repo,
118118
pattern = c("Tickets" = "ticket[[:digit:]]+", "Issues" = "#[[:digit:]]+"),
119-
ref = "master"
119+
ref = "main"
120120
) %>%
121121
select(pattern.type, pattern.content, everything())
122122
```

README.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[![R-CMD-check](https://github.com/ThinkR-open/gitdown/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/gitdown/actions)
99
[![Coverage
10-
status](https://codecov.io/gh/ThinkR-open/gitdown/branch/master/graph/badge.svg)](https://codecov.io/github/ThinkR-open/gitdown?branch=master)
10+
status](https://codecov.io/gh/ThinkR-open/gitdown/branch/main/graph/badge.svg)](https://codecov.io/github/ThinkR-open/gitdown?branch=main)
1111
[![CRAN
1212
status](https://www.r-pkg.org/badges/version/gitdown)](https://CRAN.R-project.org/package=gitdown)
1313
<!-- badges: end -->
@@ -105,19 +105,19 @@ followed by at least one number: `"#[[:digit:]]+"`. Variable
105105
`pattern.content` lists patterns found in the commit messages.
106106

107107
``` r
108-
get_commits_pattern(repo, pattern = "#[[:digit:]]+", ref = "master") %>%
108+
get_commits_pattern(repo, pattern = "#[[:digit:]]+", ref = "main") %>%
109109
select(pattern.content, everything())
110110
#> 4 commits found.
111-
#> # A tibble: 7 x 12
111+
#> # A tibble: 7 × 12
112112
#> pattern.content sha summary message author email when order
113113
#> <chr> <chr> <chr> <chr> <chr> <chr> <dttm> <int>
114-
#> 1 #32 86ec5… Add NE… "Add NE… Alice alic… 2021-05-10 14:03:56 4
115-
#> 2 #1 86ec5… Add NE… "Add NE… Alice alic… 2021-05-10 14:03:56 4
116-
#> 3 #12 86ec5… Add NE… "Add NE… Alice alic… 2021-05-10 14:03:56 4
117-
#> 4 #2 5e338… Third … "Third … Alice alic… 2021-05-10 14:03:56 3
118-
#> 5 #145 5e338… Third … "Third … Alice alic… 2021-05-10 14:03:56 3
119-
#> 6 #1 cefcf… exampl… "exampl… Alice alic… 2021-05-10 14:03:56 2
120-
#> 7 <NA> f50e2… First … "First … Alice alic… 2021-05-10 14:03:56 1
114+
#> 1 #32 8790c… Add NE… "Add NE… Alice alic… 2022-03-04 15:31:14 4
115+
#> 2 #1 8790c… Add NE… "Add NE… Alice alic… 2022-03-04 15:31:14 4
116+
#> 3 #12 8790c… Add NE… "Add NE… Alice alic… 2022-03-04 15:31:14 4
117+
#> 4 #2 c0870… Third … "Third … Alice alic… 2022-03-04 15:31:14 3
118+
#> 5 #145 c0870… Third … "Third … Alice alic… 2022-03-04 15:31:14 3
119+
#> 6 #1 a97db… exampl… "exampl… Alice alic… 2022-03-04 15:31:14 2
120+
#> 7 <NA> b27b5… First … "First … Alice alic… 2022-03-04 15:31:14 1
121121
#> # … with 4 more variables: tag.name <chr>, tag.message <chr>,
122122
#> # pattern.type <chr>, pattern.title <chr>
123123
```
@@ -129,25 +129,25 @@ vector to properly separate types of patterns.
129129
get_commits_pattern(
130130
repo,
131131
pattern = c("Tickets" = "ticket[[:digit:]]+", "Issues" = "#[[:digit:]]+"),
132-
ref = "master"
132+
ref = "main"
133133
) %>%
134134
select(pattern.type, pattern.content, everything())
135135
#> 4 commits found.
136-
#> # A tibble: 12 x 12
136+
#> # A tibble: 12 × 12
137137
#> pattern.type pattern.content sha summary message author email
138138
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
139-
#> 1 Tickets ticket6789 86ec55cd… Add NEWS "Add NEWS\n\n… Alice alice…
140-
#> 2 Tickets ticket1234 86ec55cd… Add NEWS "Add NEWS\n\n… Alice alice…
141-
#> 3 Issues #32 86ec55cd… Add NEWS "Add NEWS\n\n… Alice alice…
142-
#> 4 Issues #1 86ec55cd… Add NEWS "Add NEWS\n\n… Alice alice…
143-
#> 5 Issues #12 86ec55cd… Add NEWS "Add NEWS\n\n… Alice alice…
144-
#> 6 Tickets <NA> 5e338c4c… Third co… "Third commit… Alice alice…
145-
#> 7 Issues #2 5e338c4c… Third co… "Third commit… Alice alice…
146-
#> 8 Issues #145 5e338c4c… Third co… "Third commit… Alice alice…
147-
#> 9 Tickets ticket1234 cefcfbb7… example:… "example: mod… Alice alice…
148-
#> 10 Issues #1 cefcfbb7… example:… "example: mod… Alice alice…
149-
#> 11 Tickets <NA> f50e27f9… First co… "First commit… Alice alice…
150-
#> 12 Issues <NA> f50e27f9… First co… "First commit… Alice alice…
139+
#> 1 Tickets ticket6789 8790cc60… Add NEWS "Add NEWS\n\n… Alice alice…
140+
#> 2 Tickets ticket1234 8790cc60… Add NEWS "Add NEWS\n\n… Alice alice…
141+
#> 3 Issues #32 8790cc60… Add NEWS "Add NEWS\n\n… Alice alice…
142+
#> 4 Issues #1 8790cc60… Add NEWS "Add NEWS\n\n… Alice alice…
143+
#> 5 Issues #12 8790cc60… Add NEWS "Add NEWS\n\n… Alice alice…
144+
#> 6 Tickets <NA> c0870ab4… Third co… "Third commit… Alice alice…
145+
#> 7 Issues #2 c0870ab4… Third co… "Third commit… Alice alice…
146+
#> 8 Issues #145 c0870ab4… Third co… "Third commit… Alice alice…
147+
#> 9 Tickets ticket1234 a97db45b… example:… "example: mod… Alice alice…
148+
#> 10 Issues #1 a97db45b… example:… "example: mod… Alice alice…
149+
#> 11 Tickets <NA> b27b55fe… First co… "First commit… Alice alice…
150+
#> 12 Issues <NA> b27b55fe… First co… "First commit… Alice alice…
151151
#> # … with 5 more variables: when <dttm>, order <int>, tag.name <chr>,
152152
#> # tag.message <chr>, pattern.title <chr>
153153
```
@@ -164,11 +164,11 @@ create_vignette_last_modif(repo_pkg, path = "")
164164

165165
With this example, the vignette will show this content:
166166

167-
| File | Tracked in git | Date of creation | Last modification |
168-
|:-------------|:---------------|:--------------------|:--------------------|
169-
| NEWS.md | Yes | 2021-05-10 16:03:56 | 2021-05-10 16:03:56 |
170-
| example.txt | Yes | 2021-05-10 16:03:56 | 2021-05-10 16:03:56 |
171-
| R/my\_mean.R | No | NA | 2021-05-10 16:03:56 |
167+
| File | Tracked in git | Date of creation | Last modification |
168+
|:------------|:---------------|:--------------------|:--------------------|
169+
| NEWS.md | Yes | 2022-03-04 16:31:14 | 2022-03-04 16:31:14 |
170+
| example.txt | Yes | 2022-03-04 16:31:14 | 2022-03-04 16:31:14 |
171+
| R/my_mean.R | No | NA | 2022-03-04 16:31:14 |
172172

173173
## Sponsor
174174

dev_history.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ usethis::use_github_action("pkgdown")
6767
usethis::use_github_action("test-coverage")
6868

6969

70-
# CRAN
70+
# CRAN ----
7171
# Check content
7272
# remotes::install_github("ThinkR-open/checkhelper")
7373
checkhelper::find_missing_tags()

man/each_pattern.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.

man/get_commits_pattern.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.

man/get_commits_tags.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.

0 commit comments

Comments
 (0)