Skip to content

Commit 56d33a3

Browse files
author
Simon Prochazka
committed
chore: add error wrapping to branch_diff_commmits
- branch_diff_commits will now report which branch failed
1 parent 91e2d6d commit 56d33a3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/history/branch_diff_commits.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package history
22

33
import (
4+
"fmt"
5+
46
"gopkg.in/src-d/go-git.v4/plumbing"
57
)
68

@@ -9,25 +11,25 @@ func (g *Git) BranchDiffCommits(branchA string, branchB string) ([]plumbing.Hash
911
branchACommit, err := g.LatestCommitOnBranch(branchA)
1012

1113
if err != nil {
12-
return nil, err
14+
return nil, fmt.Errorf("Failed getting latest commit for branch %v: %v", branchA, err)
1315
}
1416

1517
branchBCommit, err := g.LatestCommitOnBranch(branchB)
1618

1719
if err != nil {
18-
return nil, err
20+
return nil, fmt.Errorf("Failed getting latest commit for branch %v: %v", branchB, err)
1921
}
2022

2123
branchACommits, err := g.CommitsOnBranch(branchACommit.Hash)
2224

2325
if err != nil {
24-
return nil, err
26+
return nil, fmt.Errorf("Failed getting commits for branch %v: %v", branchA, err)
2527
}
2628

2729
branchBCommits, err := g.CommitsOnBranch(branchBCommit.Hash)
2830

2931
if err != nil {
30-
return nil, err
32+
return nil, fmt.Errorf("Failed getting commits for branch %v: %v", branchB, err)
3133
}
3234

3335
var diffCommits []plumbing.Hash

0 commit comments

Comments
 (0)