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

branch create: Don't create or commit if store would reject #423

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

abhinav
Copy link
Owner

@abhinav abhinav commented Sep 27, 2024

By using the new BranchTx API,
we're able to check whether the store will accept the change
before we actually create the branch.

So, we now first prepare the transaction with the new branch state,
and only if that succeeds do we actually create the branch.

This way, if the store would reject the change
because the base branch is untracked or something similar,
we'll roll back to the original target branch and staged changes.

By using the new BranchTx API,
we're able to check whether the store will accept the change
before we actually create the branch.

So, we now first prepare the transaction with the new branch state,
and only if that succeeds do we actually create the branch.

This way, if the store would reject the change
because the base branch is untracked or something similar,
we'll roll back to the original target branch and staged changes.
@abhinav
Copy link
Owner Author

abhinav commented Sep 27, 2024

This change is part of the following stack:

Change managed by git-spice.

@abhinav abhinav enabled auto-merge (squash) September 27, 2024 14:53
@abhinav abhinav merged commit b008643 into main Sep 27, 2024
11 checks passed
@abhinav abhinav deleted the bc-no-commit-on-corrupt branch September 27, 2024 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant