Skip to content

Conversation

gerhardol
Copy link
Member

Proposed changes

sort copied before renamed as well as before added/removed as copied may have changes worth reviewing.

Order unequal/same/b/a in the same way as they are displayed.

Note: My primary feature is to see Copied (that may have changes) before Renamed (just moved) to simplify reviewing.
As Copied has "changes" I find it natural to see that after Modified, and Renamed should follow Copied.
But Added/Removed could be moved before Copied/Renamed

Screenshots

Before

image

After

image

Test methodology

Manual

Merge strategy

I agree that the maintainer squash merge this PR (if the commit message is clear).


✒️ I contribute this code under The Developer Certificate of Origin.

as well as before added/removed as copied may have changes worth
reviewing.

Order unequal/same/b/a in the same way as they are displayed.
Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

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

Have not run.

My first quick thoughts:
Copied is kind of an "added" file.
And it is important to me whether it is an exact copy / rename (100% similarity) or not.

So the sorting of the existing file status [icons] makes good sense to me.
(I need to move the Equal filter toolbar button.)

Would it suffice to move the submodule icons up in order to present them more prominently?

@gerhardol
Copy link
Member Author

Have not run.

My first quick thoughts: Copied is kind of an "added" file. And it is important to me whether it is an exact copy / rename (100% similarity) or not.

So the sorting of the existing file status [icons] makes good sense to me. (I need to move the Equal filter toolbar button.)

Would it suffice to move the submodule icons up in order to present them more prominently?

Also Copied can be 100% and Modified can be copied. It is not always obvious what Git presents the changes as..,

I interpret above as you support copied before renamed, but also copied/renamed before added/removed?

From a review perspective the logical order would be modified, copied, added, renamed, removed, but copied/removed are related as added/removed (latter could be copied that failed to be recognized as such).

I would prefer to have submodule changes presented as e.g. modified. Previously, they were embedded (just no special watermarked icon), fine for me. Now it seems like they are last. No major issue, not that many changes.

@mstv
Copy link
Member

mstv commented Mar 8, 2025

I interpret above as you support copied before renamed, but also copied/renamed before added/removed?

It heavily depends on the similarity.
An exact rename is least important.
A rename with modifications could be considered most important.

Added and removed should be adjacent because the Git's rename/copy detection is too limited.

Let's use this PR as it is.

Submodules should be sorted in front of FileStatusModified* in a follow-up (moving the status icons did not have an effect).

@gerhardol
Copy link
Member Author

Same should be moved last too, also not affected by icon order

@gerhardol
Copy link
Member Author

A  rename with modifications could be considered most important.

Normally seen as a copy

@mstv
Copy link
Member

mstv commented Mar 8, 2025

Same should be moved last too

matches my expectation, but was not important enough to start a discussion

also not affected by icon order

must not and cannot because of

image

and

image

@mstv
Copy link
Member

mstv commented Mar 9, 2025

(moving the status icons for submodules did not have an effect).

This might be caused by asynchronous retrieval of the submodule status. Workaround: Create submodule nodes with a default submodule icon at once, update them asynchronously.

also not affected by icon order

must not and cannot because of

This means changing the icon order cannot affect the sorting of the DiffBranchStatus, which is the primary, independent sort criterion. Sorting the enum values should suffice. Side effects?

when sorting by file status.
Also sort copied/renamed before added/removed as copied may have changes
worth reviewing.

Sort Same after B/A (so order is Unequal/B/A/Same).

Order icons for Unequal/B/A/Same in the same way as they are displayed.
@gerhardol
Copy link
Member Author

Same should be moved last too

matches my expectation, but was not important enough to start a discussion

As I changed the order of icons and mentioned it here, I changed it, updated commit message and description.

For submodules: I have no good repro now, will open an issue if I recreate the problem

Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

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

👍


Regarding submodules:

  • in a follow-up
  • async status seems to not be the root cause
  • works much better if all icons are moved, particularly SubmodulesManage and FolderSubmodule
  • status is DiffBranchStatus.Unknown which is sorted behind SameChange

@gerhardol
Copy link
Member Author

Regarding submodules:

* in a follow-up

👍

Plan to merge in some days, just finishing up the discussion here.

* async status seems to not be the root cause

That is as before, I believe.
Unequal/B/A/Same is set when the diffs are calculated, so the first key is set anyway.

* works much better if _all_ icons are moved, particularly `SubmodulesManage` and `FolderSubmodule`

I believe it is fine having modified/copied/renamed/added/removed/submodule(s), preferable in Unequal to see conflicts easily (but at least now I find it no major issue to see all submodule changes after same).
More icons to tune sorting is not of much help (well maybe the Unequal watermark...)

* status is `DiffBranchStatus.Unknown` which is sorted behind `SameChange`

That would mean that GitItemStatus.DiffStatus is overwritten, as it is set initially in src\app\GitUI\UserControls\FileStatusDiffCalculator.cs:242

@gerhardol gerhardol merged commit eb7a8f4 into gitextensions:master Mar 16, 2025
4 checks passed
@gerhardol gerhardol deleted the feature/renamed-sorting branch March 16, 2025 11:37
@mstv mstv added this to the v5.3 milestone Mar 20, 2025
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