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

Only show "Drop Commit" action for commits on the checked-out branch #365

Closed
Ghostbird opened this issue Aug 14, 2020 · 2 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Ghostbird
Copy link

Ghostbird commented Aug 14, 2020

Describe the Bug
Drop commit in git graph drops a completely different commit instead of the one selected. When the tip of the checked-out branch is not a cherry-picked commit of the dropped commit, it seems nothing happens at all. Which is kind of non-functional, but at least doesn't accidentally drop the wrong commit.

Steps to Reproduce
image
Initial situation as shown in this picture

  1. Right click the commit at the tip of the feature branch, choose Cherry pick… and confirm
  2. Right click the commit at the tip of the feature branch, choose Drop… and confirm
  3. The just cherry-picked commit is dropped from master instead.

Expected Behaviour
I expected the tip of the feature branch to be dropped, but the tip of master was dropped instead.

Environment

  • Git Graph Extension Version: 1.25.0
  • Visual Studio Code Version: 1.48.0 db40434f562994116e5b21c24015a2e40b2504e6 x64
  • Operating System: Debian GNU/Linux 10 (buster) 4.19.132-1 (2020-07-24) x86_64 GNU/Linux

Note
When I check-out the feature branch before the drop, it works correctly. Maybe the Drop… option should be disabled for non-checked-out branches.

@Ghostbird Ghostbird added the bug Something isn't working label Aug 14, 2020
@mhutchie
Copy link
Owner

Hi @Ghostbird,

Thanks for making me aware of this behaviour. After testing numerous scenarios, including the steps you describe, I also observe that unless the commit being dropped is on the checked-out branch, the Git command being run git rebase --onto <commit-hash>^ <commit-hash> doesn't behave as the user would expect. In every scenario I've tested Git Graph has called the correct underlying Git command with the correct arguments, it's just that the Git command is not behaving as expected.

After looking at other popular Git UI's, every UI that has the ability to drop commits only allows this action to be performed on the checked-out branch. This seems to confirm that this is a known limitation, so I should similarly disable "Drop..." for commits not on the checked-out branch.

I already have two conditions that disable the "Drop..." option based on Git constraints I had picked up when I initially implemented this functionality, I'll add a new constraint testing whether the commit is on the checked-out branch.

I'll have a beta release available for you to use in the next few hours that resolves this issue.

@mhutchie mhutchie changed the title Drop commit drops cherry-picked branch tip instead of selected Only show "Drop Commit" action for commits on the checked-out branch Aug 15, 2020
@mhutchie mhutchie added this to the v1.26.0 milestone Aug 15, 2020
mhutchie added a commit that referenced this issue Aug 15, 2020
@mhutchie
Copy link
Owner

This will be available in v1.26.0.

If you'd like to use it before the next release, you can download v1.26.0-beta.3, and install it following the instructions provided here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants