Skip to content

Commit c7c0d03

Browse files
committed
updateRef(): check for errors internally
That's a big part of the point of being a test helper :-)
1 parent 8d95600 commit c7c0d03

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

git_sizer_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func gitCommand(t *testing.T, repoPath string, args ...string) *exec.Cmd {
4343
return exec.Command("git", gitArgs...)
4444
}
4545

46-
func updateRef(t *testing.T, repoPath string, refname string, oid git.OID) error {
46+
func updateRef(t *testing.T, repoPath string, refname string, oid git.OID) {
4747
t.Helper()
4848

4949
var cmd *exec.Cmd
@@ -53,7 +53,7 @@ func updateRef(t *testing.T, repoPath string, refname string, oid git.OID) error
5353
} else {
5454
cmd = gitCommand(t, repoPath, "update-ref", refname, oid.String())
5555
}
56-
return cmd.Run()
56+
require.NoError(t, cmd.Run())
5757
}
5858

5959
// createObject creates a new Git object, of the specified type, in
@@ -175,8 +175,7 @@ func newGitBomb(
175175
return err
176176
})
177177

178-
err = updateRef(t, path, "refs/heads/master", oid)
179-
require.NoError(t, err)
178+
updateRef(t, path, "refs/heads/master", oid)
180179
}
181180

182181
func TestRefSelection(t *testing.T) {
@@ -244,8 +243,7 @@ func TestRefSelection(t *testing.T) {
244243
return err
245244
})
246245

247-
err = updateRef(t, path, refname, oid)
248-
require.NoError(t, err)
246+
updateRef(t, path, refname, oid)
249247
}
250248

251249
executable, err := exec.LookPath("bin/git-sizer")

0 commit comments

Comments
 (0)