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

Insert artificial commits if filter without any matches is applied #10163

Conversation

gerhardol
Copy link
Member

Fixes #10162

Proposed changes

Handle selection after refresh if artificial commits are
removed from the view

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.

@ghost ghost assigned gerhardol Aug 22, 2022
Handle selection after refresh if artificial commits are
removed from the view
@gerhardol gerhardol force-pushed the feature/i10162-artificial-TryGetParents branch from 25b7a17 to 2b19a57 Compare August 22, 2022 19:22
Comment on lines 1328 to 1338
if (notSelectedId.IsArtificial)
{
notSelectedId = CurrentCheckout is not null
? CurrentCheckout
: _gridView.ToBeSelectedObjectIds.Where(id => !id.IsArtificial).FirstOrDefault();
}

if (notSelectedId is not null)
{
parents = TryGetParents(Module, _filterInfo, notSelectedId);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

To keep it simple, the following can be reduced with the drawback that unselecting ShowArtificial while artificial is selected will not select anything

Suggested change
if (notSelectedId.IsArtificial)
{
notSelectedId = CurrentCheckout is not null
? CurrentCheckout
: _gridView.ToBeSelectedObjectIds.Where(id => !id.IsArtificial).FirstOrDefault();
}
if (notSelectedId is not null)
{
parents = TryGetParents(Module, _filterInfo, notSelectedId);
}
if (!notSelectedId.IsArtificial)
{
parents = TryGetParents(Module, _filterInfo, notSelectedId);
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Simplified this, added a comment instead
(The snippet was written when the solution was slightly different, I kept it though)

@gerhardol gerhardol added this to the 4.0.0 milestone Aug 22, 2022
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.

LGTM, I think the shorter variant suffices

…lied

Handle selection after refresh if artificial commits are
removed from the view
@gerhardol gerhardol merged commit 9602c30 into gitextensions:master Aug 25, 2022
@gerhardol gerhardol deleted the feature/i10162-artificial-TryGetParents branch August 25, 2022 22:37
@ghost ghost modified the milestones: 4.0.0, vNext Aug 25, 2022
gerhardol added a commit that referenced this pull request Aug 25, 2022
…10163)

Handle selection after refresh if artificial commits are
removed from the view

(cherry picked from commit 9602c30)
@gerhardol gerhardol modified the milestones: vNext, 4.0.0 Sep 4, 2022
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.

[NBug] Unexpected artificial commit in Git command: 22222222222222...
2 participants