@@ -239,8 +239,7 @@ func executeLocalRepoSync(srcRepo ghrepo.Interface, remote string, opts *SyncOpt
239239 git := opts .Git
240240 branch := opts .Branch
241241
242- err := git .Fetch ([]string {remote , fmt .Sprintf ("+refs/heads/%s" , branch )})
243- if err != nil {
242+ if err := git .Fetch ([]string {remote , fmt .Sprintf ("+refs/heads/%s" , branch )}); err != nil {
244243 return err
245244 }
246245
@@ -270,33 +269,28 @@ func executeLocalRepoSync(srcRepo ghrepo.Interface, remote string, opts *SyncOpt
270269 }
271270 if startBranch != branch {
272271 if hasLocalBranch {
273- err = git .Checkout ([]string {branch })
274- if err != nil {
272+ if err := git .Checkout ([]string {branch }); err != nil {
275273 return err
276274 }
277275 } else {
278- err = git .Checkout ([]string {"--track" , fmt .Sprintf ("%s/%s" , remote , branch )})
279- if err != nil {
276+ if err := git .Checkout ([]string {"--track" , fmt .Sprintf ("%s/%s" , remote , branch )}); err != nil {
280277 return err
281278 }
282279 }
283280 }
284281 if hasLocalBranch {
285282 if opts .Force {
286- err = git .Reset ([]string {"--hard" , fmt .Sprintf ("refs/remotes/%s/%s" , remote , branch )})
287- if err != nil {
283+ if err := git .Reset ([]string {"--hard" , fmt .Sprintf ("refs/remotes/%s/%s" , remote , branch )}); err != nil {
288284 return err
289285 }
290286 } else {
291- err = git .Merge ([]string {"--ff-only" , fmt .Sprintf ("refs/remotes/%s/%s" , remote , branch )})
292- if err != nil {
287+ if err := git .Merge ([]string {"--ff-only" , fmt .Sprintf ("refs/remotes/%s/%s" , remote , branch )}); err != nil {
293288 return err
294289 }
295290 }
296291 }
297292 if startBranch != branch {
298- err = git .Checkout ([]string {startBranch })
299- if err != nil {
293+ if err := git .Checkout ([]string {startBranch }); err != nil {
300294 return err
301295 }
302296 }
0 commit comments