@@ -28,12 +28,12 @@ type GitOperations interface {
2828 // Rebase operations
2929 CanRebase (branch , onto string ) (bool , []string , error ) // returns canRebase, conflictFiles, error
3030 Rebase (branch , onto string ) error
31- AbortRebase () error
31+ AbortRebase ()
3232
3333 // Merge operations
3434 CanMerge (branch , into string ) (bool , []string , error )
3535 Merge (branch , into string , squash bool ) error
36- AbortMerge () error
36+ AbortMerge ()
3737
3838 // Remote operations
3939 Fetch (remote string ) error
@@ -68,14 +68,14 @@ func (g *RealGitOps) run(args ...string) (string, error) {
6868 return strings .TrimSpace (stdout .String ()), nil
6969}
7070
71- func (g * RealGitOps ) runAllowFailure (args ... string ) ( string , error ) {
71+ func (g * RealGitOps ) runAllowFailure (args ... string ) string {
7272 cmd := exec .Command ("git" , args ... )
7373 cmd .Dir = g .WorkDir
7474 var stdout , stderr bytes.Buffer
7575 cmd .Stdout = & stdout
7676 cmd .Stderr = & stderr
7777 _ = cmd .Run () // ignore error
78- return strings .TrimSpace (stdout .String ()), nil
78+ return strings .TrimSpace (stdout .String ())
7979}
8080
8181func (g * RealGitOps ) GetCurrentBranch () (string , error ) {
@@ -146,27 +146,24 @@ func (g *RealGitOps) CanRebase(branch, onto string) (bool, []string, error) {
146146 _ , err = g .run ("rebase" , "--no-commit" , onto )
147147 if err != nil {
148148 // Get conflict files
149- conflictFiles , _ := g .getConflictFiles ()
150- _ = g .AbortRebase ()
149+ conflictFiles := g .getConflictFiles ()
150+ g .AbortRebase ()
151151 _ = g .CheckoutBranch (currentBranch )
152152 return false , conflictFiles , nil
153153 }
154154
155155 // Abort the successful rebase (we just wanted to check)
156- _ = g .AbortRebase ()
156+ g .AbortRebase ()
157157 _ = g .CheckoutBranch (currentBranch )
158158 return true , nil , nil
159159}
160160
161- func (g * RealGitOps ) getConflictFiles () ([]string , error ) {
162- output , err := g .runAllowFailure ("diff" , "--name-only" , "--diff-filter=U" )
163- if err != nil {
164- return nil , err
165- }
161+ func (g * RealGitOps ) getConflictFiles () []string {
162+ output := g .runAllowFailure ("diff" , "--name-only" , "--diff-filter=U" )
166163 if output == "" {
167- return nil , nil
164+ return nil
168165 }
169- return strings .Split (output , "\n " ), nil
166+ return strings .Split (output , "\n " )
170167}
171168
172169func (g * RealGitOps ) Rebase (branch , onto string ) error {
@@ -177,9 +174,8 @@ func (g *RealGitOps) Rebase(branch, onto string) error {
177174 return err
178175}
179176
180- func (g * RealGitOps ) AbortRebase () error {
181- _ , err := g .runAllowFailure ("rebase" , "--abort" )
182- return err
177+ func (g * RealGitOps ) AbortRebase () {
178+ g .runAllowFailure ("rebase" , "--abort" )
183179}
184180
185181func (g * RealGitOps ) CanMerge (branch , into string ) (bool , []string , error ) {
@@ -197,14 +193,14 @@ func (g *RealGitOps) CanMerge(branch, into string) (bool, []string, error) {
197193 // Try merge with no commit
198194 _ , err = g .run ("merge" , "--no-commit" , "--no-ff" , branch )
199195 if err != nil {
200- conflictFiles , _ := g .getConflictFiles ()
201- _ = g .AbortMerge ()
196+ conflictFiles := g .getConflictFiles ()
197+ g .AbortMerge ()
202198 _ = g .CheckoutBranch (currentBranch )
203199 return false , conflictFiles , nil
204200 }
205201
206202 // Abort the successful merge
207- _ = g .AbortMerge ()
203+ g .AbortMerge ()
208204 _ = g .CheckoutBranch (currentBranch )
209205 return true , nil , nil
210206}
@@ -226,9 +222,8 @@ func (g *RealGitOps) Merge(branch, into string, squash bool) error {
226222 return err
227223}
228224
229- func (g * RealGitOps ) AbortMerge () error {
230- _ , err := g .runAllowFailure ("merge" , "--abort" )
231- return err
225+ func (g * RealGitOps ) AbortMerge () {
226+ g .runAllowFailure ("merge" , "--abort" )
232227}
233228
234229func (g * RealGitOps ) Fetch (remote string ) error {
@@ -279,17 +274,17 @@ func NewTestRepo(name string) (*TestRepo, error) {
279274
280275 // Initialize repo with main as default branch
281276 if _ , err := git .run ("init" , "-b" , "main" ); err != nil {
282- os .RemoveAll (dir )
277+ _ = os .RemoveAll (dir )
283278 return nil , err
284279 }
285280
286281 // Configure git for tests
287282 if _ , err := git .run ("config" , "user.email" , "test@example.com" ); err != nil {
288- os .RemoveAll (dir )
283+ _ = os .RemoveAll (dir )
289284 return nil , err
290285 }
291286 if _ , err := git .run ("config" , "user.name" , "Test User" ); err != nil {
292- os .RemoveAll (dir )
287+ _ = os .RemoveAll (dir )
293288 return nil , err
294289 }
295290
@@ -307,7 +302,7 @@ func NewBareTestRepo(name string) (*TestRepo, error) {
307302
308303 // Initialize bare repo with main as default branch
309304 if _ , err := git .run ("init" , "--bare" , "-b" , "main" ); err != nil {
310- os .RemoveAll (dir )
305+ _ = os .RemoveAll (dir )
311306 return nil , err
312307 }
313308
@@ -316,7 +311,7 @@ func NewBareTestRepo(name string) (*TestRepo, error) {
316311
317312// Cleanup removes the test repository.
318313func (r * TestRepo ) Cleanup () {
319- os .RemoveAll (r .Path )
314+ _ = os .RemoveAll (r .Path )
320315}
321316
322317// AddRemote adds a remote to this repo.
0 commit comments