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

Correctly request force-pushing in a triangular workflow #3528

Merged
merged 6 commits into from May 19, 2024

Commits on May 19, 2024

  1. Create shims for all model classes in SessionStateLoader

    This guards against accidentally renaming a model field and thereby breaking
    user's custom commands. With this change we'll get a build failure when we do
    that.
    stefanhaller committed May 19, 2024
    Configuration menu
    Copy the full SHA
    6afcc5b View commit details
    Browse the repository at this point in the history
  2. Rename PushBranch to PushBranchAndSetUpstream

    It is unexpected that a function called PushBranch also sets the upstream
    branch; also, we want to add a PushBranch function in the next commit that
    doesn't.
    stefanhaller committed May 19, 2024
    Configuration menu
    Copy the full SHA
    c4927e2 View commit details
    Browse the repository at this point in the history
  3. Add test demonstrating the problem with force-pushing in a triangular…

    … workflow
    
    Our code doesn't realize that we need to prompt the user to force push, when the
    branch is up-to-date with its upstream but not with the branch that we're
    pushing to.
    stefanhaller committed May 19, 2024
    Configuration menu
    Copy the full SHA
    b91b40b View commit details
    Browse the repository at this point in the history
  4. Rename Pushables/Pullables to AheadForPull/BehindForPull

    In preparation for adding AheadForPush/BehindForPush in the next commit.
    stefanhaller committed May 19, 2024
    Configuration menu
    Copy the full SHA
    0aba686 View commit details
    Browse the repository at this point in the history
  5. Add ahead/behind information for @{push}

    In a triangular workflow the branch that you're pulling from is not the same as
    the one that you are pushing to. For example, some people find it useful to set
    the upstream branch to origin/master so that pulling effectively rebases onto
    master, and set the push.default git config to "current" so that "feature"
    pushes to origin/feature.
    
    Another example is a fork-based workflow where "feature" has upstream set to
    upstream/main, and the repo has remote.pushDefault set to "origin", so pushing
    on "feature" pushes to origin/feature.
    
    This commit adds new fields to models.Branch that store the ahead/behind
    information against the push branch; for the "normal" workflow where you pull
    and push from/to the upstream branch, AheadForPush/BehindForPush will be the
    same as AheadForPull/BehindForPull.
    stefanhaller committed May 19, 2024
    Configuration menu
    Copy the full SHA
    d890c68 View commit details
    Browse the repository at this point in the history
  6. Correctly request force-pushing in triangular workflows

    To determine whether we need to ask for force pushing, we need to query the push
    branch rather than the upstream branch, in case they are not the same.
    stefanhaller committed May 19, 2024
    Configuration menu
    Copy the full SHA
    c5cf1b2 View commit details
    Browse the repository at this point in the history