From 15e81f1232f8e151771eb22d48d04d0217e55e4b Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Wed, 18 Jan 2023 13:34:59 -0800 Subject: [PATCH] GitOpsTest: use an explicit default branch --- .../scala/org/scalafmt/sysops/GitOpsTest.scala | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scalafmt-tests/src/test/scala/org/scalafmt/sysops/GitOpsTest.scala b/scalafmt-tests/src/test/scala/org/scalafmt/sysops/GitOpsTest.scala index 68f5f89d3b..77c5909e8e 100644 --- a/scalafmt-tests/src/test/scala/org/scalafmt/sysops/GitOpsTest.scala +++ b/scalafmt-tests/src/test/scala/org/scalafmt/sysops/GitOpsTest.scala @@ -232,8 +232,8 @@ class GitOpsTest extends FunSuite { add(f1) add(f2) commit - assertEquals(diff("master").toSet, Set(f1, f2)) - assertEquals(diff("master", dir).toSet, Set(f2)) + assertEquals(diff(defaultBranch).toSet, Set(f1, f2)) + assertEquals(diff(defaultBranch, dir).toSet, Set(f2)) } test( @@ -249,8 +249,8 @@ class GitOpsTest extends FunSuite { add(f1) add(f2) modify(f1) - assertEquals(diff("master").toSet, Set(f1, f2)) - assertEquals(diff("master", dir).toSet, Set(f2)) + assertEquals(diff(defaultBranch).toSet, Set(f1, f2)) + assertEquals(diff(defaultBranch, dir).toSet, Set(f2)) } test("diff should not return removed files against a different branch") { @@ -264,7 +264,7 @@ class GitOpsTest extends FunSuite { add(f2) commit rm(f1) - assertEquals(diff("master").toSet, Set(f2)) + assertEquals(diff(defaultBranch).toSet, Set(f2)) } test("status should return only modified files") { @@ -338,6 +338,8 @@ class GitOpsTest extends FunSuite { private object GitOpsTest { + private final val defaultBranch = "main" + // Filesystem commands def rmfs(file: AbsoluteFile): Unit = file.delete() @@ -353,7 +355,7 @@ private object GitOpsTest { } def init(implicit ops: GitOpsImpl): Unit = - git("init") + git("init", "-b", defaultBranch) def add(file: AbsoluteFile*)(implicit ops: GitOpsImpl): Unit = git("add", file.map(_.toString()): _*)