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

When reordering two commits, you get to resolve the same conflict twice #132

Open
anordal opened this issue Apr 16, 2023 · 0 comments
Open

Comments

@anordal
Copy link
Contributor

anordal commented Apr 16, 2023

When two commits touch the same line, and you reorder them, you obviously get a conflict. But you get to resolve it twice, one for the first and one for the other.

I don't think the second conflict is interesting, because the correct state after both commits is already known. It would be convenient to just not be asked about that one.

anordal added a commit to anordal/git-revise that referenced this issue May 14, 2023
anordal added a commit to anordal/git-revise that referenced this issue May 14, 2023
anordal added a commit to anordal/git-revise that referenced this issue May 14, 2023
anordal added a commit to anordal/git-revise that referenced this issue May 14, 2023
anordal added a commit to anordal/git-revise that referenced this issue May 29, 2023
Move this test aspect out of the way, so the end state can be kept.

Prework for mystor#132
anordal added a commit to anordal/git-revise that referenced this issue May 29, 2023
Change the example so that leftover_index becomes empty.

To make leftover_index empty, i.e. keep the final state unchanged
as a sum of both changes, it makes more conceptual sense
when one commit does not effectively revert the other.

That should also be more representative of real commits that can
sensibly be reordered.

Prework for mystor#132
anordal added a commit to anordal/git-revise that referenced this issue May 29, 2023
It is fair to assume that the user never wants or expects
the sum of changes to be different after reordering them.
That would be an impure reordering,
which is not what the user is asking for.
Even if the conflicts are resolved by the user or git-rerere,
it is fair to assume such a result to be a failure.

This commit simply always upholds this invariant
for the practical benefit of not bothering the user
about a conflict with a known resolution.

I can hear critics say that this is an assumption,
and it's safer not to assume. The answer to that is plainly no:
There is only one correct solution to the second conflict given the first.
Not just in theory, but when you do this exercise day in and day out
and see that the second conflict is always a rearrangement of the first,
you want to spend your time on making the first one right.

Implements mystor#132
anordal added a commit to anordal/git-revise that referenced this issue Jul 28, 2023
Move this test aspect out of the way, so the end state can be kept.

Prework for mystor#132
anordal added a commit to anordal/git-revise that referenced this issue Jul 28, 2023
Change the example so that leftover_index becomes empty.

To make leftover_index empty, i.e. keep the final state unchanged
as a sum of both changes, it makes more conceptual sense
when one commit does not effectively revert the other.

That should also be more representative of real commits that can
sensibly be reordered.

Prework for mystor#132
anordal added a commit to anordal/git-revise that referenced this issue Jul 28, 2023
It is fair to assume that the user never wants or expects
the sum of changes to be different after reordering them.
That would be an impure reordering,
which is not what the user is asking for.
Even if the conflicts are resolved by the user or git-rerere,
it is fair to assume such a result to be a failure.

This commit simply always upholds this invariant
for the practical benefit of not bothering the user
about a conflict with a known resolution.

I can hear critics say that this is an assumption,
and it's safer not to assume. The answer to that is plainly no:
There is only one correct solution to the second conflict given the first.
Not just in theory, but when you do this exercise day in and day out
and see that the second conflict is always a rearrangement of the first,
you want to spend your time on making the first one right.

Implements mystor#132
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

No branches or pull requests

1 participant