gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Hard to understand changeset

Open roderik opened this issue 6 months ago • 2 comments

CleanShot 2024-02-04 at 10 35 32@2x

the ..(uiBuilder line switched places with the CommonLayerModule which vscode and Tower show in a way that is understandable

CleanShot 2024-02-04 at 10 36 50@2x CleanShot 2024-02-04 at 10 37 26@2x

What is weird is that the second part of the changeset, where CommonLayerModule is added on line 73, has does not show uiBuilder on line 72.

This either needs to be 1 changeset like the tower screenshot or in part 2 line 72 should be the uiBuilder line

roderik avatar Feb 04 '24 09:02 roderik

Hey! Thanks for this feedback. So the reason the diff is presented in this way is because the app uses zero context line diffs.

(Like the output from git diff --unified=0 )

The advantage is that you have flexibility in moving things around. Perhaps this could be something that you can configure

krlvi avatar Feb 04 '24 09:02 krlvi

I agree that this is confusing. I understand the effort to keep each change hunk as small and independent as possible, but if the app is going to display line context around a change, the context should at least represent the current state of the file. Screenshot 2024-02-28 at 09 17 36

MichaelOwenDyer avatar Feb 28 '24 08:02 MichaelOwenDyer

Thanks for the feedback. Based on your input, as well as other folks in the community I went ahead and changed the hunks to contain context from the get go. With that change you will no longer be seeing these confusing diffs.

There is one caveat though - because virtual branches use line numbers for tracking where you allocate diffs, this change is not backwards compatible. For that reason, the app will switch to using diffs with context lines only after you have zero virtual branches (both applies as well as unapplied in the sidebar). Make sure to complete any work in progress you may have as well as delete any old (forgotten) unapplied virtual branches in the left sidebar and the tool will migrate automatically.

Let me know if you have any trouble with this.

krlvi avatar Mar 15 '24 22:03 krlvi

Seems to work well in latest nightly

roderik avatar Mar 16 '24 20:03 roderik