Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote: add RequireRemoteRefs to PushOptions #258

Merged
merged 1 commit into from Mar 25, 2021

Commits on Feb 18, 2021

  1. add RequireRemoteRefs to PushOptions

    The git protocol itself uses a compare-and-swap mechanism, where changes
    send the old and new values and the change is only applied if the old
    value matches. This is used to implement the --force-with-lease feature
    in git push.
    
    go-git populates the `old` field with the current value of the ref that
    is read from the remote. We can implement a convenient (albeit more
    limited) form of the --force-with-lease feature just by allowing the
    caller to specify particular values for this ref.
    
    Callers can then implement complex multi-step atomic operations by
    reading the ref themselves at the start of the process, and passing to
    in RequireRemoteRefs at the end. This is also a suitable building block
    for implementing --force-with-lease (go-git#101), which is mostly an exercise
    in computing the correct hash to require. Hence, this appears to be the
    most reasonable API to expose.
    asuffield committed Feb 18, 2021
    Copy the full SHA
    a39eddc View commit details
    Browse the repository at this point in the history