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
}