gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Conflict with empty branches #15

Open danielo515 opened this issue 1 year ago • 3 comments

Version

0.12.12

Operating System

Mac OS X

Distribution Method

dmg (Apple Silicon)

Describe the issue

Hello. I was just testing the most basic feature (having a virtual branch and just push changes to it), and at some point, after pushing, I got an error like this: Screenshot 2024-07-19 at 14 45 30

As you can see, there is not branches referenced (which I assume they should) and as a result, I am now in some kind of limbo. My project as a weird branch stashed and I don't know how to fix those conflicts that do not appear anywhere.

How to reproduce

I think it is because I had my original branch rebased trunk?

Expected behavior

A more robust way of dealing with conflicts. I understand conflicts may happen, but in this scenario I was completely hands tied. I had to opt out the 'running branch' and start dealing with git manually.

Relevant log output

No response

danielo515 avatar Jul 23 '24 06:07 danielo515

Thanks a lot for reporting! Indeed, I would have imagined it going more smoothly as well. Could you retry with the latest version? It's v0.12.14 at the time of writing this.

Also, there is a Project History button that might allow you to go back to a working state. Screenshot 2024-07-23 at 17 16 32

I think a starting point would be to handle the case where there seemingly are no branches. Of course, all that would be easier if it was reproducible. If the repository is public, maybe it's possible to retrace your steps.

Byron avatar Jul 23 '24 15:07 Byron

Well, this repo is not publicly available, and I actually panic and just fallback to just doing manual things. I still love the idea of what you are doing, and will continue to try using it. Will give it a go in my personal public projects to see if I can reproduce this issue

danielo515 avatar Jul 24 '24 06:07 danielo515

It looks like this should happen on any base branch update when there's a conflict between the base branch and applied branches. The Rust interface returns a list of branches as strings, but the UI side expects a Branch object that has a name.

From the construction of the error message in branchCotroller.ts, it's assumed that the Rust function update_base_branch returns an array of VirtualBranch. But it currently returns Result<Vec<ReferenceName>> (it used to return Result<Vec<git2::Branch<'_>>> ).

In the UI I saw that ReferenceName is a string that looks like refs/heads/Virtual-branch-1. If the conflict handling is going to change in the near future, I think it would be nice if Gitbutler displayed this refs (or without the refs/heads/ prefix), just to make it easier to know which branches conflicted. This should be a relatively small change.

Comnir avatar Aug 17 '24 13:08 Comnir