-
Notifications
You must be signed in to change notification settings - Fork 3
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
Atomic updates #1
Comments
It's probably a lot easier to implement this now that git has included a new hook https://git-scm.com/docs/githooks#_reference_transaction that enable refs to be updated within a transation. You can check the documentation of git-update-ref to see how to start/commit/abort a ref update transaction https://www.git-scm.com/docs/git-update-ref |
Another option is to have |
@sluongng Thanks for the tip! I looked around. It looks like that'll require a process that runs as long as the entire rebase operation, posting updates to the open transaction in the background, and then eventually committing. That sounds more complex than recording state on-disk, and then committing that state at the end. @kriskowal thanks for that suggestion as well. I'll try to play with both options a little more later if I get a chance. |
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.10.2 to 0.10.5. - [Release notes](https://github.com/RustCrypto/hashes/releases) - [Commits](RustCrypto/hashes@sha2-v0.10.2...sha2-v0.10.5) --- updated-dependencies: - dependency-name: sha2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Currently, if a rebase fails after a few branches have been updated, you're
left in an inconsistent state where half the branches have been updated and
the other ones are still pointing to the old tree.
For example, in,
If
pick C
fails and yougit rebase --abort
,feature1
has still beenmoved to a new position.
An alternative method is to use
update-ref
to place markers for wherebranches will go if everything succeeds and commit these changes only if
everything was successful.
Then, if the rebase succeeds, we'll want to run
branch -f
with these refs.Something equivalent to the following should suffice,
This would be pretty unreadable to users but I think we can provide a nicer UI
on top.
Instead of adding
exec git branch -f
orexec git update-ref
instructions,the
git-rebase-todo
that the user sees will contain a custommark
instruction. The main instruction set will be followed by a lone
restack
command which indicates the point at which the branches will be updated. The
opt-in
push
will follow therestack
.Caveat: This introduces custom language to
git-rebase-todo
. We cantechnically avoid this by calling back into
restack
from the instructionlist without too much loss in readability. I'm undecided on this.
CC @kriskowal
The text was updated successfully, but these errors were encountered: