File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,12 @@ func CurrentBranch() (string, error) {
2929 return firstLine (output ), nil
3030 }
3131
32- ce := err .(* run.CmdError )
33- if ce .Stderr .Len () == 0 {
34- // Detached head
35- return "" , errors .New ("git: not on any branch" )
32+ var cmdErr * run.CmdError
33+ if errors .As (err , & cmdErr ) {
34+ if cmdErr .Stderr .Len () == 0 {
35+ // Detached head
36+ return "" , errors .New ("git: not on any branch" )
37+ }
3638 }
3739
3840 // Unknown error
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import (
1414// OutputStub implements a simple utils.Runnable
1515type OutputStub struct {
1616 Out []byte
17- Error * run. CmdError
17+ Error error
1818}
1919
2020func (s OutputStub ) Output () ([]byte , error ) {
@@ -49,6 +49,7 @@ func (cs *CmdStubber) Stub(desiredOutput string) {
4949}
5050
5151func (cs * CmdStubber ) StubError (errText string ) {
52+ // TODO support error types beyond CmdError
5253 stderrBuff := bytes .NewBufferString (errText )
5354 args := []string {"stub" } // TODO make more real?
5455 err := errors .New (errText )
You can’t perform that action at this time.
0 commit comments