Skip to content

Commit 9a145b8

Browse files
committed
Fix unit tests for other default branch names
1 parent 4660d9c commit 9a145b8

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

‎DESCRIPTION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: gert
33
Title: Simple Git Client for R
4-
Version: 2.1.5
4+
Version: 2.2.0
55
Authors@R: c(
66
person("Jeroen", "Ooms", role = c("aut", "cre"), email = "[email protected]",
77
comment = c(ORCID = "0000-0002-4035-0289")),

‎NEWS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
2.2.0
22
- Windows: update to libgit2 1.9.1
3+
- Fix unit tests for other default branch names
34

45
2.1.4
56
- Fix for libgit2 1.8.2 reverting their API change from 1.8.0

‎tests/testthat/test-commit.R‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,14 @@ test_that("status reports a conflicted file", {
100100
writeLines("cranky-crab-legs", foo_path)
101101
git_add("foo.txt", repo = repo)
102102
base <- git_commit("Add a file", repo = repo)
103+
main <- git_branch(repo = repo)
103104

104105
git_branch_create("my-branch", repo = repo)
105106
writeLines("cranky-CRAB-LEGS", foo_path)
106107
git_add("foo.txt", repo = repo)
107108
git_commit("Uppercase last 2 words", repo = repo)
108109

109-
git_branch_checkout("master", repo = repo)
110+
git_branch_checkout(main, repo = repo)
110111
expect_equal(git_merge_analysis("my-branch", repo = repo), "fastforward")
111112

112113
writeLines("CRANKY-CRAB-legs", foo_path)

‎tests/testthat/test-merge.R‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ test_that("merge analysis works", {
1010
git_add("test.txt")
1111
git_commit(paste("This is commit number:", i))
1212
}
13+
main <- git_branch()
1314
master_log <- git_log()
1415
first_commit <- tail(master_log$commit, 1)
1516
git_branch_create('new', first_commit)
1617
git_branch_checkout('new')
1718
expect_equal(git_log()$commit, tail(master_log,1)$commit)
18-
expect_equal(git_merge_analysis('master'), 'fastforward')
19+
expect_equal(git_merge_analysis(main), 'fastforward')
1920

2021
# Expect no merge commit (ffwd)
21-
git_merge("master")
22+
git_merge(main)
2223
expect_equal(master_log, git_log())
2324

2425
# Create a branch that diverges
@@ -27,18 +28,18 @@ test_that("merge analysis works", {
2728
writeLines('Something else', 'test2.txt')
2829
git_add('test2.txt')
2930
git_commit("Some other commit")
30-
expect_equal(git_merge_find_base('master'), first_commit)
31+
expect_equal(git_merge_find_base(main), first_commit)
3132

3233
# Require merge commit
33-
expect_equal(git_merge_analysis('master'), 'normal')
34-
git_merge('master')
34+
expect_equal(git_merge_analysis(main), 'normal')
35+
git_merge(main)
3536
newlog <- git_log()
3637
expect_length(newlog$commit, 3)
3738
expect_equal(newlog$merge, c(TRUE, FALSE, FALSE))
3839
expect_null(git_merge_parent_heads())
3940

4041
# Expect no changes
41-
git_merge('master')
42+
git_merge(main)
4243
expect_equal(git_log(), newlog)
4344
})
4445

0 commit comments

Comments
 (0)