Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Don't include git reference in remote.PushContext #1304

Description

@carsonoid

Right now, non fast-forward errors during remote pushes create a new error which includes the git reference :

return fmt.Errorf("non-fast-forward update: %s", cmd.Name.String())
worktree.go has a dedicated ErrNonFastForwardUpdate error which should be used instead.

The main issue is that these two bits of code work differently:

err := w.PullContext(ctx, options) // might return a git.ErrNonFastForwardUpdate
if err != nil && err == git.ErrNonFastForwardUpdate { 
  // this code might get  executed
}


err := r.PushContext(ctx, options) // might return result of fmt.Errorf("non-fast-forward update: %s", cmd.Name.String())
if err != nil && err == git.ErrNonFastForwardUpdate { 
  // this code can never get executed
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions