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

[Bug] Fix removal of unstaged changes on branch change #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MercuricChloride
Copy link
Contributor

I came across what I think to be a bug, or at the very least a non obvious interaction when using the git interface.

When a repository has unstaged changes, and we create a new branch, or switch to another branch, all unstaged changes are reverted.

While we can fix this by going into the code changes and reverting, I think the default functionality should be closer to how git normally works, which is that checking out a new branch should not remove unstaged changes, unless a force flag is passed.

This is the default behaviour of the morphic git interface in pharo as well.

Let me know what you think!

@hellerve hellerve self-requested a review January 29, 2025 20:47
@hellerve hellerve self-assigned this Jan 29, 2025
Copy link
Member

@hellerve hellerve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s add an example and then we’re good to go!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I’m not opposed to the changes in this file, they seem unrelated. I don’t necessarily think we need to remove them, but wanted to point them out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this actually was from a monkey patch that I added to my personal config. The bigger inlays match the styling of other dropdown menus. But we don't have to include it since it isn't relevant to the actual fix i'm changing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep this in, it doesn’t really change the intent of the change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work well! Can we add an example for it? GtGitElementExamples>>#scripterOnExpandedElementWithEditedBranch could be a starting point for how it can be done.

If you need help or guidance, let me know!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So when adding the example, should I invoke this example in another example for using the changes?

So invoke self scripterOnExpandedElementWithEditedBranch, then checkout to a new branch to show the changes persist?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, apologies for the delayed answer. I think that’s the way to go, yes. Change the branch (with some changes), assert that the changes are still there.

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.

2 participants