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

"Stashed" changes from a branch switch must be cherry-picked instead of loaded #173

Closed
j4yk opened this issue Apr 15, 2018 · 1 comment
Closed

Comments

@j4yk
Copy link
Collaborator

j4yk commented Apr 15, 2018

When switching between branches, Squot creates private commits that stash away (without using the git stash) the uncommitted changes. These commits naturally have the branch tip as their parent commit.
However, when the history of the branch is later rewritten, the stash commit stays at the original tip of the branch. Currently, in #switchAndMoveUnsavedChangesOverTo:, the stash version is simply loaded, which might unnecessarily load an out-of-date version of the branch. Instead, the stashed changes should be cherry-picked (without saving/committing) to the current branch tip.

For performing merges on the Squot code itself, this is important because it might break loading altogether. For other projects that merely use Squot, it might simply confuse the users because they may see vast diffs and do not know where they come from. But unnecessary patching of the memory is always a bad thing in case something goes wrong.

This is related to #160, but it is not the same problem from a functional perspective. Here the situation is that the head commit has "moved" in the history, so there is an "equivalent" version in the branch and the unsaved changes should be preserved, whereas in #160 the head was deliberately changed to another version, so it might be better to drop the unsaved changes.

j4yk added a commit that referenced this issue Apr 29, 2018
The temporary version with the officially unsaved changes will now be merged,
not loaded. Ref #173
@j4yk j4yk closed this as completed May 20, 2018
@j4yk j4yk added this to the release 0.6.0 milestone May 20, 2018
@j4yk
Copy link
Collaborator Author

j4yk commented Mar 2, 2019

Even though the issue title clearly states "cherry-pick" I only made sure that the ancestry is not affected by the merging of the "unsaved" changes. So, it still merges all the changes up to the temporary commit, instead of cherry-picking just this commit. This is bad if the branch was reset to an earlier commit. The changes discarded from the branch will be loaded again when Squot switches to the branch. Reopening.

@j4yk j4yk reopened this Mar 2, 2019
@j4yk j4yk modified the milestones: release 0.6.0, release 0.7.0 Mar 2, 2019
@j4yk j4yk closed this as completed in 6268188 May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant